Commit 432b02f
committed
fix: tolerate an unresolvable grammar in export model generation
The sibling-grammar lookup in ExportGeneratorX.getGrammar demand-loads
<name>.xtext next to the export model; for models with no such sibling
(every test .export file, models built via ParseHelper) the load throws
and the builder participant logs "Error during compilation" and silently
aborts generation for the file — dozens of ERROR entries in every full
test run, and the generator's main path never executes over the test
fixtures.
Make grammar resolution defensive: guard a missing resource or resource
set, reject unresolved targetGrammar proxies, and catch the demand-load
failure, returning null. Downstream, GeneratorUtil.allInstantiatedTypes
treats a null grammar as "no parser-instantiated subtypes" (covering
typeMap and canContain), and the remaining generator call sites already
tolerate a null grammar (grammar?.name in ExportedNamesProviderGenerator;
an explicit null check in ResourceDescriptionManagerGenerator). Export
model generation now degrades gracefully instead of aborting.
Phase 0 of #1458.1 parent f3f4e1a commit 432b02f
3 files changed
Lines changed: 42 additions & 5 deletions
File tree
- com.avaloq.tools.ddk.xtext.export.test/src/com/avaloq/tools/ddk/xtext/export/generator
- com.avaloq.tools.ddk.xtext.export/src/com/avaloq/tools/ddk/xtext/export/generator
- com.avaloq.tools.ddk.xtext.expression/src/com/avaloq/tools/ddk/xtext/expression/generator
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
74 | 100 | | |
75 | 101 | | |
76 | 102 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | 50 | | |
52 | | - | |
| 51 | + | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
0 commit comments