Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Could not serialize Mission via backtracking
Could not serialize Mission via backtracking [message #1796385] Fri, 12 October 2018 04:05 Go to next message
Eclipse UserFriend
Hello!

So I'm having problems with my project (again). I'm working with both Xtext and Sirius, so I don't really know where the problem lies. The thing is that when working with both syntaxes at the same time there are certain objects that return an error (see below) when being added from Sirius. It doesn't happen when adding those objects from Xtext, they just pop up in the graphical syntax as usual. Those objects are the ones inheriting from abstract classes (my workspace: https://www.dropbox.com/s/hgamlrayc4ymjlz/workspace.zip?dl=0). However, only one of the objects gives an error when specified in Sirius. In my grammar it would be the object Event, but not Action (also "ordered locations" but not "not ordered locations"). I realized that the order in the grammar is important since if I exchange (for instance) the position of events and actions the object returning error also changes. I hope I could explain it properly. Thank you in advance.

Best regards,
Sergio

PS: I first published this issue in the Sirius forum, but they referred me to this forum (https://www.eclipse.org/forums/index.php/m/1795167/#msg_1795167)


!ENTRY org.eclipse.core.jobs 4 2 2018-09-17 17:17:32.464
!MESSAGE An internal error occurred during: "Saving Models and Representations for project promise_integration".
!STACK 0
java.lang.RuntimeException: Could not serialize Mission via backtracking.
Constraint: Mission_Mission returns Mission: (
(conditions+=Event conditions+=Event*)?
(conditions+=Action conditions+=Action*)?
robots+=Robot
robots+=Robot*
(location+=OrderedLocation location+=OrderedLocation*)?
(location+=NotOrderedLocation location+=NotOrderedLocation*)?
operator+=Operator
operator+=Operator*
);
Values: operator(1), conditions(24), robots(3), location(6)
Semantic Object: Mission
URI: platform:/resource/promise_integration/mission2.promise
Context: Mission returns Mission
at org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic$ExceptionThrowingAcceptor.accept(ISerializationDiagnostic.java:131)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:503)
at se.gu.co4robots.xtext.promise.serializer.PromiseSemanticSequencer.sequence_Mission(PromiseSemanticSequencer.java:395)
at se.gu.co4robots.xtext.promise.serializer.PromiseSemanticSequencer.sequence(PromiseSemanticSequencer.java:108)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:67)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:115)
at org.eclipse.xtext.serializer.impl.Serializer.serializeToRegions(Serializer.java:136)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:142)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:189)
at org.eclipse.xtext.resource.XtextResource.doSave(XtextResource.java:386)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
at org.eclipse.sirius.business.internal.session.danalysis.ResourceSaveDiagnose.hasDifferentSerialization(ResourceSaveDiagnose.java:84)
at org.eclipse.sirius.business.internal.session.IsModifiedSavingPolicy.hasDifferentSerialization(IsModifiedSavingPolicy.java:210)
at org.eclipse.sirius.business.internal.session.IsModifiedSavingPolicy.computeResourcesToSave(IsModifiedSavingPolicy.java:191)
at org.eclipse.sirius.business.api.session.AbstractSavingPolicy.save(AbstractSavingPolicy.java:57)
at org.eclipse.sirius.common.xtext.internal.XtextSavingPolicy.save(XtextSavingPolicy.java:68)
at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$1.run(DAnalysisSessionImpl.java:828)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave(DAnalysisSessionImpl.java:837)
at org.eclipse.sirius.business.internal.session.danalysis.Saver.wrappedSave(Saver.java:142)
at org.eclipse.sirius.business.internal.session.danalysis.Saver.access$0(Saver.java:131)
at org.eclipse.sirius.business.internal.session.danalysis.Saver$1.run(Saver.java:119)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2262)
at org.eclipse.sirius.business.internal.session.danalysis.Saver.saveNow(Saver.java:116)
at org.eclipse.sirius.business.internal.session.danalysis.Saver.save(Saver.java:93)
at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:801)
at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:796)
at org.eclipse.sirius.diagram.ui.tools.internal.resource.CustomSiriusDocumentProvider.doSaveDocument(CustomSiriusDocumentProvider.java:279)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider$1SaveOperation.execute(AbstractDocumentProvider.java:596)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider$DocumentProviderOperation.run(AbstractDocumentProvider.java:66)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider.executeOperation(AbstractDocumentProvider.java:530)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider.saveDocument(AbstractDocumentProvider.java:579)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.performSave(DiagramDocumentEditor.java:864)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.doSave(DiagramDocumentEditor.java:684)
at org.eclipse.sirius.ui.business.internal.session.SaveSessionRunnable.run(SaveSessionRunnable.java:62)
at org.eclipse.ui.internal.SaveableHelper$2.run(SaveableHelper.java:370)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Re: Could not serialize Mission via backtracking [message #1796389 is a reply to message #1796385] Fri, 12 October 2018 05:36 Go to previous messageGo to next message
Eclipse UserFriend
Hi

This might be an Xtext serializer bug. I have found that it cannot handle complex multi-uses.

However your

'locations' '{' ('ordered' ':' location+=OrderedLocation ( "," location+=OrderedLocation)*)?
('not' 'ordered' ':' location+=NotOrderedLocation ( "," location+=NotOrderedLocation)*)? '}'

has two single and two multiple assignments to location which should be all right since they are different types.

The serialization challenge summary:

(location+=OrderedLocation location+=OrderedLocation*)?
(location+=NotOrderedLocation location+=NotOrderedLocation*)?

seems consistent but perhaps the content analysis

location(6)

has over-simplified. Alternatively perhaps you neglected to order your locations as mandated by the grammar.

Regards

Ed Willink




Re: Could not serialize Mission via backtracking [message #1796511 is a reply to message #1796389] Mon, 15 October 2018 10:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ed,

Thank you very much for your answer. However, I don't really understand what you mean with:

Quote:

Alternatively perhaps you neglected to order your locations as mandated by the grammar.


Notice that I have the same problems with conditions (i.e. actions and events). Do you see a way to get rid of this problem?

Best regards,
Sergio
Re: Could not serialize Mission via backtracking [message #1796512 is a reply to message #1796511] Mon, 15 October 2018 10:58 Go to previous messageGo to next message
Eclipse UserFriend
can you please create a unit test reproducing the problem?
Re: Could not serialize Mission via backtracking [message #1796517 is a reply to message #1796512] Mon, 15 October 2018 11:46 Go to previous messageGo to next message
Eclipse UserFriend
I've checked how to create a unit test in Xtext, but I'm not completely sure of how to do it in this case since the error only arises when adding nodes from Sirius to Xtext. I reduced the problem making the example smaller. Event and Action classes inherit from the Condition abstract class.

If, for instance, I have an example without actions and I add events to my graphical syntax and save, they are correctly parsed by Xtext. But, if I add an action then I cannot add more events without getting an error (always the same, see what I attached in the first message).

Sorry if this is not enough, let me know if you need more info and I'll try to provide it.
Re: Could not serialize Mission via backtracking [message #1796518 is a reply to message #1796517] Mon, 15 October 2018 12:00 Go to previous messageGo to next message
Eclipse UserFriend
simply create a ast as you can see it from sirius e.g. in the debugger and try to save it in a xtext resource
Re: Could not serialize Mission via backtracking [message #1796700 is a reply to message #1796518] Wed, 17 October 2018 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi

"Alternatively perhaps you neglected to order your locations as mandated by the grammar."

Your grammar specifies that location comprises 0 or more OrderedLocation followed by 0 or more NotOrderedLocation.

'locations' '{' ('ordered' ':' location+=OrderedLocation ( "," location+=OrderedLocation)*)?
('not' 'ordered' ':' location+=NotOrderedLocation ( "," location+=NotOrderedLocation)*)? '}'

If you interleave OrderedLocation and NotOrderedLocation, the serialization must fail.

Regrads

Ed Willink
Re: Could not serialize Mission via backtracking [message #1796840 is a reply to message #1796700] Fri, 19 October 2018 12:12 Go to previous message
Eclipse UserFriend
Hi again,

I've debugged the application and I checked how the ast was built. And, yes, in the ast the locations and conditions where interleaved, which triggered the error. I changed my metamodel and everything works fine now. Thank you both for your help!

Best regards,
Sergio
Previous Topic:Set line endings for code generated by xtend-maven-plugin
Next Topic:quickfixprovider for vscode
Goto Forum:
  


Current Time: Sun Jun 15 05:59:38 EDT 2025

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

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

Back to the top