Skip to content

Fix/java codegen versioned namespace#204

Open
ospreyboi wants to merge 2 commits intoaccordproject:mainfrom
ospreyboi:fix/java-codegen-versioned-namespace
Open

Fix/java codegen versioned namespace#204
ospreyboi wants to merge 2 commits intoaccordproject:mainfrom
ospreyboi:fix/java-codegen-versioned-namespace

Conversation

@ospreyboi
Copy link

@ospreyboi ospreyboi commented Mar 8, 2026

Closes #159

Hello!!
I was exploring the Accord Project codebase
and stumbled across this bug. I tried generating Java code
from a versioned Concerto model and noticed the version was just
silently dropped from the package name
which makes the output
incorrect and breaks downstream consumers.

Turns out parseNamespace() already returns the version, it just
was not being used! The fixing was surprisingly small — just two lines
changed to destructure version alongside name and include it
in the namespace string when present.

I also added a dedicated test case for versioned namespaces and
updated the snapshots so everything is consistent.

Changes

  • lib/codegen/fromcto/java/javavisitor.js — fixed startClassFile
    and import generation to include version in namespace when present
  • test/codegen/fromcto/java/javavisitor.js — added test for versioned namespace
  • Updated snapshots to reflect corrected output

Signed-off-by: ospreyboi <akshaosprey460@gmail.com>
Signed-off-by: ospreyboi <akshaosprey460@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing version numbers in Java codegen

1 participant