dangling reference to a derived object [message #1810241] |
Mon, 05 August 2019 16:03  |
Eclipse User |
|
|
|
Hello again,
I've spent the last couple of days trying to get fancy and I've potentially shot myself in the foot.
I have a situation where my DSL has a lot of derived objects that are implicitly declared. I have to dynamically derive them within my DerivedStateComputer. Which seems to be working well.
In this derivation, I can tell if a higher level object should be declared that can associate all these derived objects. The trouble is, my DSL doesn't have a declarative way declare this higher level association.
I'm am therefore creating this higher level association in a Singleton object I create on the fly. When I determine my derived objects can be associated, I get my Singleton instance and I create that association object within the Singleton.
The trouble is, other parts of my DSL need to reference these derived associations. When I do this, I get the complaint during linking/validation:
The feature 'connectionBundleRef' of XXX contains a dangling reference 'pbx.impl.ConnectionBundleImpl@fde068b{#//@connectionBundles.643}'
Somewhere else the error is more clear and indicates that the ConnectionBundleImpl is not contained in a resource - which I suppose it is not because it's derived on the fly and contained within my top level Singleton (The Singleton seems EMF enough to get a resource, but maybe not)
Is there a way to present my top level Singleton as an Xtext resource and thus "lie" to Xtext telling it these derived associated objects (ConnectionBundles) are able to be crossreference?
I have created a ResourceDescriptionStrategy to govern what objects make it into the index, but the method createEObjectDescriptions, never gets an argument e that is of the type ConnectionBundle - so I can't use my ResourceDescriptionStrategy as a way to get these objects into the Index as far as I can tell - I never get the chance to decide if they should be there or not. Which confuses me. Perhaps that's because the objects of that type are not seen as being within a Resource?
|
|
|
|
|
|
|
Re: dangling reference to a derived object [message #1810403 is a reply to message #1810317] |
Fri, 09 August 2019 10:56   |
Eclipse User |
|
|
|

Hopefully this picture helps.
My derived Connections are able to be added to the PBXDocuments - the documents for my DSL.
But I need to create an overall association of these derived Connections, which I call ConnectionBundles. There is no place in the DSL where these ConnectionBundles are described, so they are, indeed, not contained within an resource.
I have a DSL file that can make references to these ConnectionBundles - and thus I am referencing an Object that has easy access to all the associated Connections.
Route returns Route:
connectionBundleRef=[ConnectionBundle|ID] ':'
BEGIN
'paths' ':' ((BEGIN '-' paths+=Path ('-' paths+=Path)* END) | '-' paths+=Path ('-' paths+=Path)* )
END
;
I can scope and validate that ConnectionBundle reference, but I can't get past the dangling reference error. When I'm scoping the ConnectionBundle and Connection references in this highly cross referenced file, I simply access my pbxApp.getInstance() singleton which contains a list of derived ConnectionBundles.
I have a file that is predominantly built with crossReferences to ConnectionBundles (and the associated derived Connections). What I'm finding is when I load my application and that file is loaded, ALL references are marked as errors - all derived ConnectionBundles and Connections. The Connections are derived and contained within Resources, so I don't understand why their derivations aren't being triggered. I'm having to Project -> Clean to get any of those objects built and linked.
I can understand why the ConnectionBundles are not created, but the cross references to Connections, that are derived and contained within resources, I don't understand why the builder isn't triggering a build and creating them. Is it because there's major cross reference error before them?
This last part is why I don't know if simply turning off this dangling reference error will solve my problem (plus I haven't figured out how to turn off the error yet.)
Attachment: UML.PNG
(Size: 175.91KB, Downloaded 246 times)
[Updated on: Fri, 09 August 2019 11:14] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03850 seconds