Community
Participate
Working Groups
Build Identifier: I20110613-1736 As a rule, inferred jvm types should shadow 'physical' (e.g. generated) Java types. That is, if the inferred jvm type exists, the reference will be linked to it; if not, the reference will be linked to the corresponding 'physical' Java type (if it exists). This behavior is not always obeyed in Xtext editors in presence of cross-resource references, as we shall see below. Reproducible: Always Steps to Reproduce: 1. Import the standard 'Xtext Domain-Model Example' projects into the workspace. 2. Run the runtime workbench and import the attached 'example' project into the runtime workspace. 3. Open 'Foo.dmodel' and 'Bar.dmodel' in Xtext editors. 4. In 'Bar.dmodel' point to 'Foo' in the 'extends foo.Foo' clause. A hover 'Entity Foo' appears (as expected). 5. Switch to 'Foo.dmodel' and comment out 'entity Foo {}'. Switch back to 'Bar.dmodel' and point to the 'Foo'. A hover 'foo.Foo' [Java class] appears (that's expected, because now the reference resolves to the generated Java class). 6. Switch to 'Foo.dmodel' and uncomment 'entity Foo {}'. Switch back to 'Bar.dmodel' and point to the 'Foo' again. A hover 'foo.Foo' [Java class] appears (that's NOT expected). If we then try to navigate to the 'Foo', it will open 'Foo.java', not 'Foo.dmodel'. Debugging shows that the last change to 'Foo.dmodel' (#6) does not cause relinking in 'Bar.dmodel' (i.e. JvmModelXbaseLazyLinker is not called for 'Bar.dmodel').
Created attachment 201573 [details] 'example' project
Debugging revealed that this bug is caused by bug 354910. In particular, at step 5 the resource 'Foo.dmodel' is unloaded from the resource set underlying the 'Bar.dmodel' editor. At step 6 DirtyStateEditorSupport#UpdateEditorStateJob is run for 'Bar.dmodel', but the editor's resource set doesn't contain the affected resource 'Foo.dmodel' (it was unloaded at step 5) and reparse is not deemed required because 'Bar.dmodel' has no imported names (and hence, will not be 'affected' by _any_ delta). Thus both conditions are false in 'if (affectedResources != null && !affectedResources.isEmpty() || isReparseRequired[0])' and no relinking occurs.
can no longer be reproduced