| Summary: | Dangling references in editor, but not in builder | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Achim Demelt <achim.demelt> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED INVALID | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | sven.efftinge | ||||
| Version: | 2.0.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Achim Demelt
So you have these errors when editing the Xtext grammar for your language? What kind of references do you have to other grammars and Ecore models? No, these errors occur in the editor for my language, not the grammar editor. There are no references to other grammars, but I use my own Ecore model and do not derive the metamodel from the grammar. could you please debug and tell us what the EObject without the resource looks like? Created attachment 198804 [details]
Object state in debugger
This screenshot shows the EObject (ModuleImpl) without a resource. The object itself and all its children are perfectly ok, their data is correct, all references are set and valid. It simply has no eResource, which it should have because ModuleImpl is the root of the object graph.
IIRC I saw in the debugger that the resource has been unloaded at some point during re-parsing of the file and that the re-parsed object tree has been loaded correctly. It seems that the linker did not notice that new object graph and still uses the old one.
Are you doing any kind of modifications? Maybe you should also check, whether a cross reference is used for a containment reference. (In reply to comment #5) > Are you doing any kind of modifications? No, I do not modify the model in any way. Neither the top-level Module object, nor any other model element. However, during validation I do create some new objects. But I checked again that these objects do not interfere with the objects created by Xtext, especially that they do not pull an EObject out of its eContainer. > Maybe you should also check, whether a cross reference is used for a > containment reference. I checked, but everything looks ok. A Module can reference other Modules, which is declared as a cross-reference in the grammar and defined as a non-containment reference in the Ecore model. Any other hints how I can debug this? My bad. I mentioned that I created new EObjects during validation. These EObjects reference some of my model EObjects parsed by Xtext. I had good intentions of caching these newly created objects. After re-parsing in the editor, the model EObjects referenced by my EObjects got unloaded from the resource. When I then hand out my cached objects, Xtext picks up the unloaded objects and correctly yields the "dangling reference" error. Now I no longer cache these objects and everything works fine. Sorry to bother you. I'll try to file a *real* bug next time ;-) |