Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 1] Could not serialize cross reference when saving programmatically created model
[Xtext 1] Could not serialize cross reference when saving programmatically created model [message #800954] Fri, 17 February 2012 18:42 Go to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 313
Registered: July 2009
Senior Member
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.
Re: [Xtext 1] Could not serialize cross reference when saving programmatically created model [message #800974 is a reply to message #800954] Fri, 17 February 2012 19:19 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 313
Registered: July 2009
Senior Member
Bug found, it was an error in my transformation. Some elements weren't
correctly added to a container, thus they couldn't be cross-referenced.
Will add at least a warning to my transformation engine ;-)

Cheers,
Jens
Re: [Xtext 1] Could not serialize cross reference when saving programmatically created model [message #871478 is a reply to message #800954] Mon, 14 May 2012 05:53 Go to previous message
Heinrich Müller is currently offline Heinrich MüllerFriend
Messages: 10
Registered: March 2012
Junior Member
Could you post a small snippet of the changes you made for it to work?
Previous Topic:Specify DSL files to build
Next Topic:Xtext picking unexpected rules
Goto Forum:
  


Current Time: Fri Dec 04 15:44:54 GMT 2020

Powered by FUDForum. Page generated in 0.02098 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top