Skip to content

Document what sets the package and path of generated Java - #2

Merged
sergej-koscejev merged 1 commit into
specificlanguages:mainfrom
vaclav:generated-java-package-and-path
Oct 1, 2026
Merged

sergej-koscejev merged 1 commit into
specificlanguages:mainfrom
vaclav:generated-java-package-and-path

Conversation

@vaclav

@vaclav vaclav commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Adds docs/generated-java-package-and-path.md, answering: what decides the package statement and output directory
of a generated BaseLanguage classifier, which property a programmatic caller must set, and whether virtualPackage
is that property.

  • Classifier.packageName drives both, via two independent paths (textgen header vs. TextUnit.getFilePath() +
    TextGen_Facet). When empty, both fall back to the model long name, not the default package.
  • virtualPackage is a logical-view property; no textgen code reads it.
  • JavaParser recovers the package but never sets packageName; JavaToMpsConverter carries it only in
    module-target mode, by model name.
  • Edge cases: duplicate-name detection only on the fallback branch; generate into model folder makes the directory
    diverge from the package for single-file models.

Versions: verified from source on 252.23892 (0f12866f47e7), 261.25134 (499c4a0fe6bf) and 262.9437
(060a56244647); decisive methods are identical across all three. JAR locations checked against an MPS 2025.3
distribution.

Evidence: source-verified; no runtime probe. The silent overwrite of two same-named roots sharing a packageName
is marked Inferred, and non-BaseLanguage textgen is listed as Unresolved.

Classifier.packageName drives both the package statement and the output
directory through two independent code paths; when empty, both fall back
to the model long name. Covers virtualPackage (not read by textgen),
package recovery by JavaParser and JavaToMpsConverter, and the generate
into model folder case. Verified from source on 252.23892, 261.25134 and
262.9437.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sergej-koscejev
sergej-koscejev merged commit d780dd3 into specificlanguages:main Oct 1, 2026
1 check passed
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.

2 participants