Skip to content

[Bug]: Flow-node ids folding to generated structural names (then/Next/Inner) produce non-compiling Relations code #68

Description

@emaarco

Description

The typed navigation graph introduced in PR #55 (implementing #54) reshapes the generated Relations section and adds structural members that are not derived from BPMN ids — the scope/per-node then(), the Next successor holder, and the Inner subprocess scope. Node objects and their accessors, by contrast, are derived from element ids via toCamelCase. When an element id folds onto one of these structural names, the generated Kotlin/Java Relations fails to compile.

CollisionDetectionService does not catch this: the flow-node collision check added in #63 (ADR-011) only compares element-derived names against each other (getRawName().toCamelCase()), not against the generator's reserved structural names. Before #55, Relations used UPPER_SNAKE_CASE properties with no such members, so this collision surface is new to that PR.

This ticket asks to evaluate the real-world likelihood and decide on a fix — e.g. reserve the structural names (then, Next, Inner, and the per-node name / calledProcess fields) in the collision rule, or escape/namespace them in the generator.

Steps to Reproduce

  1. Create a BPMN process with a start event and a flow node whose id is next (or then).
  2. Generate the Process API (Kotlin or Java).
  3. Compile the generated …ProcessApi source.

Expected Behaviour

Either the model is rejected up front with a clear collision error (consistent with the existing identifier-folding detection from #63 / ADR-011), or the generator escapes/namespaces the structural members so that any valid BPMN id produces compiling code.

Actual Behaviour

Validation passes, but the generated Relations does not compile — e.g. Conflicting declarations: object Next, object Next for id next, or a property/function clash on then for id then. Java produces the equivalent "already defined" errors (duplicate nested class Next; two then() methods differing only by return type).

Plugin Version

n/a — introduced on PR #55 (branch emaarco/analyze-scenario-test-builder), not yet released

Process Engine

Not applicable

Output Language

Kotlin (Java affected equivalently)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions