Skip to content

fix(export): keep a null export-model name out of the generated documentation - #1544

Merged
joaodinissf merged 1 commit into
masterfrom
fix/export-inferrer-null-name
Sep 22, 2026
Merged

joaodinissf merged 1 commit into
masterfrom
fix/export-inferrer-null-name

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

Closes the one fidelity gap a blind adversarial review found in the final Xtend→Java batch (#1536), and aligns one twin inconsistency.

What changed

  • ExportJvmModelInferrer: the export … for … header is optional, so ExportModel.name is null for every header-less model. The Xtend original appended it through StringConcatenation, which appends nothing for null; the migrated .formatted call rendered the text "null" into the generated resource description manager's documentation. The name is now guarded with Strings.emptyIfNull, the same guard the scope inferrer already uses.
  • ScopeExpressionCompiler.calledFeature: get(0) becomes null-on-empty, matching the export twin and the Xtend head it replaced. Only the exception on an unreachable empty id list changes.
  • New ExportJvmModelInferrerTest parses a header-less export model, runs inference and asserts the manager's documentation. It fails before the fix and passes after. The export test bundle gains the two JVM-model dependencies and a version bump for its changed sources.

Verification

  • Module gate (compile, PMD, CPD, Checkstyle, SpotBugs) green; full CI-equivalent verify green apart from the known testBulkApplyingQuickfix SWTBot flake, which reproduces identically without this change.
  • Differential generation over a corpus of 11 export and scope models, including kitchen-sink models covering every grammar rule and expression kind and a header-less export model placed next to its grammar: 88 generated Java and trace files, byte-identical between the 19.2.0 release bundles and this branch. The corpus and scripts live in the private reproducer repository.

🤖 Generated with Claude Code

…entation

The `export <name> for <grammar>` header is optional, so `ExportModel.name` is
null for every header-less model - which is every model the repository itself
carries. The Xtend original appended that name through StringConcatenation,
which appends nothing for null; the migrated `String.formatted` call renders it
as the literal text "null" instead, so the resource description manager was
documented as "Resource description manager for null resources.". Guard the
name with `Strings.emptyIfNull`, the same guard the scope inferrer already
applies at its two setDocumentation sites.

Align ScopeExpressionCompiler.calledFeature with its export twin as well: the
Xtend original used `head`, which yields null on an empty list, whereas the
migrated `get(0)` throws. The id list of a feature call type is never empty in
practice, so this only aligns the behaviour of an unreachable branch.

ExportJvmModelInferrerTest covers the documentation: it parses a header-less
export model, installs the derived state and asserts the documentation of the
inferred resource description manager. The inferrer resolves an export model's
grammar from the `.xtext` file next to it, so the test registers an empty
resource under that URI; the documentation under test does not depend on the
grammar. Both resources must share a resource set, hence the explicit set up
instead of the test utility call, which hands out a fresh resource set per
invocation. The test bundle gains the xbase and common.types dependencies the
JVM model API needs, and a version bump for its changed sources.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@joaodinissf
joaodinissf marked this pull request as ready for review September 22, 2026 21:36
@joaodinissf
joaodinissf merged commit 3461219 into master Sep 22, 2026
4 checks passed
@joaodinissf
joaodinissf deleted the fix/export-inferrer-null-name branch September 22, 2026 21:37
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