Skip to content

fix(export,scope): record the Java types a model names as dependencies - #1556

Merged
joaodinissf merged 2 commits into
dsldevkit:masterfrom
joaodinissf:fix/export-extension-dependencies
Sep 30, 2026
Merged

joaodinissf merged 2 commits into
dsldevkit:masterfrom
joaodinissf:fix/export-extension-dependencies

Conversation

@joaodinissf

@joaodinissf joaodinissf commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1554

Why the change

A change to a Java class that an export or scope model names only by name (an extension, an inject, or a type in an expression) now re-queues the model, so its generated Java no longer goes stale.

Special things to note

  • These names are only resolved while the Java is generated, so before this change they were neither references nor imported names of the model. Types that the generated model references directly were already tracked, through its references.
  • Only names the model states are added; the inferred JVM model's own imported names are left as they are. Recording those as dot-separated names (they are currently single-segment and never match) is a separate change.
  • An include cycle between scope models still overflows the stack in the Scope inferrer; that is pre-existing and not changed here.

Change outline

Where the pieces live:

 com.avaloq.tools.ddk.xtext.expression/
+└── resource/AbstractExpressionModelResourceDescriptionManager.java   # adds the named Java types to the imported names
 com.avaloq.tools.ddk.xtext.export/
+├── resource/ExportResourceDescriptionManager.java                    # extension classes, expression types
 └── ExportRuntimeModule.java                                          # + binding
 com.avaloq.tools.ddk.xtext.scope/
+├── resource/ScopeResourceDescriptionManager.java                     # + inject types, and those of included models
 └── ScopeRuntimeModule.java                                           # + binding

What a model imports now:

 imported names of a model
   names from linking and from the inferred JVM model     (unchanged)
+  extension classes                   com::acme::^export::Util  -> com.acme.export.util
+  inject types (Scope)                com.acme.util.Helper      -> com.acme.util.helper
+  qualified types in expressions      (com::acme::Node) this    -> com.acme.node
+  the same for every included scope model (cycle-guarded)

Tests, red-green checked (bindings removed: these fail; restored: 380 tests, 0 failures):

  • ExportResourceDescriptionManagerTest: extension class and expression types are imported and affect the model.
  • ScopeResourceDescriptionManagerTest: own and included extension, inject and factory types are imported, and a type only an included model names affects the model; a model without them is not affected.

🤖 Generated with Claude Code

rubenporras
rubenporras previously approved these changes Sep 28, 2026
joaodinissf and others added 2 commits September 29, 2026 01:23
Java types named in `extension` and `inject` declarations and in expressions
(casts, collection element types, receivers of static calls) are resolved only
while the Java is generated, so they were neither imported names nor
references of an export or scope model, and a change to such a type did not
re-queue the model. Export and Scope now bind resource description managers,
sharing a base class in the expression bundle, that add these types to the
model's imported names in the form in which changed Java types are reported.
For Scope this includes the types named by included scope models, which the
generated provider uses as well.

Fixes dsldevkit#1554

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the helper that parses an export model next to an empty grammar resource
into ExportTestUtil, so ExportJvmModelInferrerTest and
ExportResourceDescriptionManagerTest no longer duplicate it (CPD).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgVRfQCTxSDwGrN8J5s6fd
@joaodinissf
joaodinissf force-pushed the fix/export-extension-dependencies branch from c01a214 to ee533fa Compare September 28, 2026 23:29
@joaodinissf joaodinissf changed the title fix(export,scope): record extension classes as dependencies of the model fix(export,scope): record the Java types a model names as dependencies Sep 29, 2026
* the segments of the qualified type name, must not be {@code null}
* @return the name, never {@code null}
*/
protected static QualifiedName javaName(final List<String> segments) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a protected method and all consumers use split to create an array, why not have the input parameter String[]? You can have a stream on the array as well and avoid the object creation.

@joaodinissf
joaodinissf merged commit 7e984a2 into dsldevkit:master Sep 30, 2026
4 checks passed
@joaodinissf
joaodinissf deleted the fix/export-extension-dependencies branch September 30, 2026 14:00
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.

Export: classes named in extension declarations are not build dependencies of the export model

2 participants