[Xtext 1] Could not serialize cross reference when saving programmatically created model [message #800954] |
Fri, 17 February 2012 18:42 |
|
Hi all,
to cut a long story short: when saving an Xtext/ecore based simple model
(w/o any external references) created programmatically , an exception is
thrown:
org.eclipse.xtext.parsetree.reconstr.XtextSerializationException:
Could not serialize cross reference from
root.child[5]->element.ref to root.child[6]->element
at
o.e.x.parsetree.reconstr.impl.AbstractParseTreeConstructor$AssignmentToken.serializeInternal(AbstractParseTreeConstructor.java:254)
o.e.x.p.reconstr.impl.AbstractParseTreeConstructor$AbstractToken.serialize(AbstractParseTreeConstructor.java:155)
o.e.x.p.reconstr.impl.AbstractParseTreeConstructor.write(AbstractParseTreeConstructor.java:739)
o.e.x.p.reconstr.impl.AbstractParseTreeConstructor.write(AbstractParseTreeConstructor.java:734)
...
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:993)
Note that the cross-reference is NOT an inter-resource reference. The
only problem seems to be that the reference target is serialized after
the referrer. Actually, I can serialize other models in which this is
not the case or which do not have any cross-references at all.
Longer explanation:
I have a transformation language (as an plugin) which can operate on
arbitrary EMF based models. The models are created using dynamic EMF
features. Now, I want to create a model for which an Xtext based
environment is present, let's call it myDsl model. From my
transformation language's point of view, it doesn't matter whether it is
a "pure" ecore based model or if there exists an Xtext based
parser/serializer. Anyway, it shouldn't matter, should it?
Saving the model with all myDsl components disabled is working. Of
course, in that case an XML file is created instead of a DSL-like text
file.(But all links in the XML file are correct)
The myDsl components, particularly the generated editor, are working
fine. I have implemented scoping for myDsl, and even inter-resource
cross references are working.
I'm a little puzzled, as all components work fine when running
independently. Is it possible that one Xtext based component somehow
affects another one, especially the scoping stuff?
Cheers,
Jens
P.S.: Still using Xtext 1.x due to project restrictions.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03885 seconds