Commit 7cba137
committed
Skip type-incompatible imports in ModelAssembler.resolveImports
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.
Skip such an import with a warning instead: an import that resolves to an
incompatible element is a contribution error, not a reason to abort
assembly. The reference is left unset and every other fragment still
applies. Also skip, rather than NPE, an unresolved import on a
many-valued feature. Add a regression test covering the type mismatch.
Fixes #41481 parent a217bfc commit 7cba137
3 files changed
Lines changed: 64 additions & 1 deletion
File tree
- bundles/org.eclipse.e4.ui.workbench
- META-INF
- src/org/eclipse/e4/ui/internal/workbench
- tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
775 | 775 | | |
776 | 776 | | |
777 | 777 | | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
778 | 786 | | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
779 | 792 | | |
780 | 793 | | |
781 | 794 | | |
| |||
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
340 | 342 | | |
341 | 343 | | |
342 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
343 | 393 | | |
344 | 394 | | |
345 | 395 | | |
| |||
0 commit comments