Problem
dynamia new doesn't validate that the computed Java/Kotlin/Groovy base package
(groupId + '.' + artifactId.replace(/-/g, '.')) is actually a valid package name for the
target language before generating. Two concrete failure modes found while smoke-testing the
26.9.0 release:
- Reserved words:
--artifact-id final-java (groupId com.acme) computes base package
com.acme.final.java -- final is a reserved word in Java/Groovy, so the generated project
fails to compile with cryptic errors like <identifier> expected. Kotlin is unaffected since
it treats final as a soft/contextual keyword.
- Leading-digit segments:
--artifact-id smoke-java-2 computes base package
com.acme.smoke.java.2 -- a package segment can't start with a digit in Java/Kotlin/Groovy.
Fails with ';' expected (Java) or a Groovy stub-generation parse error, again with no hint
about the actual cause.
Impact
A user picks a project name that happens to collide with a language keyword or produces an
invalid package segment, and gets a wall of mvn/compiler errors with no indication the CLI
itself is the source of the problem.
Proposed fix
In platform/packages/cli/src/commands/new.ts (or a small helper in utils/), validate the
computed base package before cloning/generating:
- Each dot-separated segment must not be empty, must start with a letter or underscore (not a
digit), and must not be a reserved word in the target language (Java reserved words are a
superset that also covers Groovy; Kotlin's hard keywords are a smaller list -- soft keywords
like final are fine to allow for Kotlin specifically).
- On failure, show a clear message before cloning anything, e.g.
--artifact-id "final-java"
would produce an invalid package segment "final" (Java reserved word) -- pick a different
artifact ID, and re-prompt (interactive) or exit with DT-COMMAND-003` (non-interactive).
Repro: dynamia new --name x --scaffold backend --backend-lang java --group-id com.acme --artifact-id final-java --yes --no-git, then cd x/backend && ./mvnw compile.
Problem
dynamia newdoesn't validate that the computed Java/Kotlin/Groovy base package(
groupId + '.' + artifactId.replace(/-/g, '.')) is actually a valid package name for thetarget language before generating. Two concrete failure modes found while smoke-testing the
26.9.0 release:
--artifact-id final-java(groupIdcom.acme) computes base packagecom.acme.final.java--finalis a reserved word in Java/Groovy, so the generated projectfails to compile with cryptic errors like
<identifier> expected. Kotlin is unaffected sinceit treats
finalas a soft/contextual keyword.--artifact-id smoke-java-2computes base packagecom.acme.smoke.java.2-- a package segment can't start with a digit in Java/Kotlin/Groovy.Fails with
';' expected(Java) or a Groovy stub-generation parse error, again with no hintabout the actual cause.
Impact
A user picks a project name that happens to collide with a language keyword or produces an
invalid package segment, and gets a wall of
mvn/compiler errors with no indication the CLIitself is the source of the problem.
Proposed fix
In
platform/packages/cli/src/commands/new.ts(or a small helper inutils/), validate thecomputed base package before cloning/generating:
digit), and must not be a reserved word in the target language (Java reserved words are a
superset that also covers Groovy; Kotlin's hard keywords are a smaller list -- soft keywords
like
finalare fine to allow for Kotlin specifically).--artifact-id "final-java"would produce an invalid package segment "final" (Java reserved word) -- pick a different
artifact ID
, and re-prompt (interactive) or exit withDT-COMMAND-003` (non-interactive).Repro:
dynamia new --name x --scaffold backend --backend-lang java --group-id com.acme --artifact-id final-java --yes --no-git, thencd x/backend && ./mvnw compile.