Repository navigation
Conversation
Contributor
Author
|
The new test is supposed to fail, this is to demo the problem. |
Contributor
vogella
force-pushed
the
lv/modelassembler-import-type-regression-test
branch
from
July 2, 2026 17:12
0236660 to
7cba137
Compare
vogella
force-pushed
the
lv/modelassembler-import-type-regression-test
branch
from
September 2, 2026 22:48
7cba137 to
06560c8
Compare
vogella
force-pushed
the
lv/modelassembler-import-type-regression-test
branch
from
October 6, 2026 09:01
06560c8 to
358a51e
Compare
vogella
marked this pull request as ready for review
October 6, 2026 10:27
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation addresses both failure modes with focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents model assembly failures when fragment imports resolve to type-incompatible or missing elements.
Changes:
- Validates resolved imports against the target feature type.
- Removes unresolved imports from many-valued references.
- Adds regression tests for both scenarios.
| File | Description |
|---|---|
ModelAssembler.java |
Safely skips invalid import resolutions with warnings. |
ModelAssemblerTests.java |
Tests incompatible and unresolved imports. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
resolveImports resolves fragment <imports> by elementId via ModelUtils.findElementById, which returns the first match regardless of type, and then eSets it onto the target reference. When the model contains a different-typed element sharing the imported id, the eSet fails with a ClassCastException and aborts assembly of the whole application model. For example ResourceHandlerTest fails in the I-builds with "BindingTableImpl cannot be cast to MBindingContext", because BindingToModelProcessor.createTable() gives each generated BindingTable the binding-context id as its own elementId, so a fragment importing that BindingContext resolves to the same-id BindingTable. Treat such an import as unresolved and log a warning instead: an import that resolves to an incompatible element is a contribution error, not a reason to abort assembly. A single-valued reference is cleared as for any unresolved import, and an unresolved import in a many-valued reference is now removed from the list instead of failing with an NPE. Fixes eclipse-platform#4148 Assisted-by: multiple AI agents and layers of automated tooling 🤖
vogella
force-pushed
the
lv/modelassembler-import-type-regression-test
branch
from
October 6, 2026 22:26
358a51e to
3375345
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ModelAssembler.resolveImportsresolves fragment<imports>byelementIdonly, ignoring the element type, then sets whatever it finds on the target reference. When a fragment imports an element whose id collides with a different-typed element already in the model, the resolved element is not assignable to the reference and model assembly aborts with aClassCastException. This is what breaksResourceHandlerTestin the I-builds (BindingTableImpl cannot be cast to MBindingContext).The import is now skipped with a warning instead of aborting the whole application model: an import that resolves to an incompatible element is a contribution error, so the reference is left unset and every other fragment still applies. Unresolved imports on many-valued features are skipped rather than throwing an NPE. A regression test in
ModelAssemblerTestscovers the type mismatch.Fixes #4148