Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Loading Xtext Resource Into EMF Editor Breaks on Save?
Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763831] Sun, 21 May 2017 13:50 Go to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 268
Registered: May 2012
Senior Member
Not sure if this is appropriate, but I'm cross posting this via copy/paste to this Xtext area. The initial feedback from the EMF section was unclear.


I have a simple EMF model in which I have built the standard edit/editor plug-ins and therefore have a basic EMF editor that I can use to edit my EMF model. My EMF model has references to an Xtext DSL I've created. I have validated that all the models talk to one another and that I can create links from the EMF model to the Xtext model and the links are persisted as I want them to be.

I have found, however, that even loading the Xtext resource into the EMF editor is enough to break the editor while the doSave() method is being called. I don't have to have created any links between the models to get this broken behavior. In order to save, I have to close the dirty editor, and only then can I save the file without the following errors.

I can't put my finger on what is happening. All I have to do is load both models into the editor, and if I change anything in the EMF model to trigger a dirty setting, I get the following error:

!ENTRY company.domain..editor 2 0 2017-05-17 15:49:53.066
!MESSAGE
!STACK 0
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:398)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:481)
at dfdft.presentation.dfdftEditor.doSave(dfdftEditor.java:1527)
at org.eclipse.ui.internal.DefaultSaveable.doSave(DefaultSaveable.java:51)
at org.eclipse.ui.Saveable.doSave(Saveable.java:220)


Followed by a stack overflow inducing chain of these:

at org.eclipse.xtext.validation.impl.ConcreteSyntaxConstraintProvider.containsRelevantElement(ConcreteSyntaxConstraintProvider.java:318)
at org.eclipse.xtext.validation.impl.ConcreteSyntaxConstraintProvider.containsRelevantElement(ConcreteSyntaxConstraintProvider.java:318)

Each of the models validates on its own and there are no links between them.

Any ideas?

Edit: It is not my current intention to let people edit the Xtext DSL resource using this editor, I am only trying to demonstrated edits of my EMF model (which isn't Xtext).

Is this something to do with serialization of the Xtext model and even if I don't want to edit it, I need to provide some kind of serialization description?
Re: Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763832 is a reply to message #1763831] Sun, 21 May 2017 13:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
well ConcreteSyntaxConstraintProvider should not go into a stackoverflow.

=> bug

please file ticket with minimal sample grammar and test model and step by step to reproduce. (best would be a unit test)

(the problem should happen in a simply load and save standalone unit test as well



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 21 May 2017 13:56]

Report message to a moderator

Re: Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763835 is a reply to message #1763832] Sun, 21 May 2017 16:44 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Shouldn't stackoverflow, but in practice it can be slightly expensive to check that every reference is non-cyclic. This is generally the job of the input validation, so that input processing does not need to be paranoid and slow. Have you tried validating your input? Do you have constraints that prohibit cycles? You may well find that you accidentally created one.

Regards

Ed Willink
Re: Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763885 is a reply to message #1763835] Mon, 22 May 2017 14:39 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 268
Registered: May 2012
Senior Member
Replying to Ed W's questions:

I'm able to:
1) Load, validate, edit, and Save my EMF model in its generated EMF Editor
2) Load a parallel xtext file into the same editor - two resources are present now: my emf model and my xtext model. I can validated both and they pass.

I am able to create this error by:
1) Loading the xtext file with the Sample Reflective Ecore Model Editor. If I do an edit, I see the Resource/Editor gets marked as dirty, but when I save, I get spammed with the error I posted.
2) Loading both the EMF model and the Xtext model in the same editor (the one autogenerated for my EMF model). Both validate independently. No links are made from my EMF model to my xtext model. If I edit my EMF model, the editor gets marked as dirty, and when I save, I get spammed with these errors.
Re: Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763888 is a reply to message #1763885] Mon, 22 May 2017 15:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no, you misunderstood that. i meant the grammar itself.
it might contain a construct that the xtext validator for the grammar during serialization is not expecting and thus running into the stackoverflow.
you might find out using the debugger which place of the grammar that is


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763963 is a reply to message #1763888] Tue, 23 May 2017 12:33 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 268
Registered: May 2012
Senior Member
Okay, I see what you're saying now. The grammar does validate. However, I started this grammar with an ANTLR3 grammar published by the IEEE. I had to make several changes and turn on back tracking, so they may be something nasty lurking in there somewhere.
Re: Loading Xtext Resource Into EMF Editor Breaks on Save? [message #1763967 is a reply to message #1763963] Tue, 23 May 2017 12:57 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no i mean:

your grammar has a construct the guy that worte that validator did not have in mind
=> bug in xtext
=> would be interesting to see "what" in your/a grammar causes this.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Is Parser generated by XText thread safe?
Next Topic:ScopeProvider and Linker
Goto Forum:
  


Current Time: Fri Apr 19 22:21:12 GMT 2024

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

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

Back to the top