Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340409

Summary: [serializer] Resilient Serialization
Product: [Modeling] TMF Reporter: Ed Willink <ed>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: mkomor, moritz.eysholdt
Version: 2.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ed Willink CLA 2011-03-18 06:42:02 EDT
[Maybe only of interest to a too small community of inept developers.]

Xtext works primarily as a text to model; user enters text, another tool uses the model. Xtext also works backwards; a tool produces the model; Xtext displays text to user.

If a tool produces an inadequate model, (multiple root, missing object, ...) serialization fails with obscure diagnostics.

It would be helpful if serialization synthesized dummy error nodes, or comment wrappers, so that any loadable XMI file could be displayed to aid understanding/debugging. cf. GMF displays orphan artefacts as red boxes.
Comment 1 Moritz Eysholdt CLA 2011-03-29 09:06:07 EDT
some context...

with Xtext 1.0.x, the error messages are produced by the ConcteteSyntaxValidator. That works in the very most cases, but not in all. For example it doesn't work when assigned actions are involved. In those cases, the ParseTreeConstructor creates the error messages. Those are obscure, indeed.

once bug 333976 "replace backtracking algorithm with declarative approach" is finished, however, there will be better error messages.

Additionally to that I think that your suggestions to write out dummy error tokens can be a good idea. That way the user will always get some document by serializing a model and errors in the model will lead to syntax errors in the document.
Comment 2 Mary Komor CLA 2011-10-28 00:57:13 EDT
I am very interested in this feature as well. 

See newsgroup posting: http://www.eclipse.org/forums/index.php/t/261200/
Comment 3 Sven Efftinge CLA 2012-11-21 03:09:42 EST
It's much easier to come up with proper information if you know the language and the tools. So I suggest if you have such a use case add respective validation rules.