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

Bug 402659

Summary: error markers inconsistent on saving file
Product: [Modeling] TMF Reporter: Dietmar Stoll <btickets>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: christoph.gutmann, ed, knut.wannheden, serano, sven.efftinge, work.mra
Version: 2.3.1Flags: sven.efftinge: kepler+
Target Milestone: M7   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Sample Eclipse Project, Sample DSL file, Screenshots
none
Screenshot after step 1
none
Screenshot after step 2
none
Screenshot after step 3
none
Screenshot after step 4 none

Description Dietmar Stoll CLA 2013-03-07 10:00:18 EST
Created attachment 228069 [details]
Sample Eclipse Project, Sample DSL file, Screenshots

Steps to reproduce: The attached file contains a sample DSL project, sample DSL files and screenshots. Import the attached projects in the Eclipse Workspace, create the Xtext artifacts, start the runtime Workbench and import the sample project in the attached file.

Step 1 (screenshot step-1.png): open a.mydsl, b.mydsl (and optionally c.mydsl), clean project
a validation error is shown in the editor, problems view, project explorer

Step 2 (screenshot step-2.png): change refernce in b.mydsl, save
UNEXPECTED: validation error stays, shown in editor (grey), problems view, project explorer

Step 3 (screenshot step-3.png): make a.mydsl dirty and save it
all error markers disappear

Step 4 (screenshot step-4.png): change reference in b.mydsl, save
UNEXPECTED: validation error shown only in the editor

The behavior after step 2 and step 4 is unexpected.
Comment 1 Dietmar Stoll CLA 2013-03-07 10:08:27 EST
Created attachment 228070 [details]
Screenshot after step 1
Comment 2 Dietmar Stoll CLA 2013-03-07 10:08:55 EST
Created attachment 228071 [details]
Screenshot after step 2
Comment 3 Dietmar Stoll CLA 2013-03-07 10:09:30 EST
Created attachment 228072 [details]
Screenshot after step 3
Comment 4 Dietmar Stoll CLA 2013-03-07 10:09:58 EST
Created attachment 228073 [details]
Screenshot after step 4
Comment 5 Ed Willink CLA 2013-03-08 11:54:28 EST
Possibly duplicates Bug 367777.
Comment 6 Ed Willink CLA 2013-03-22 08:13:30 EDT
The problem may be as simple as

"Save" erases Expensive Validation warnings from the Problems View.
Comment 7 Sven Efftinge CLA 2013-04-17 03:37:34 EDT
By default Xtext only reparses/-validates files if referenced names have changed. 
In the described scenario you are expecting a change although the referenceable elements haven't changed but just an "implementation detail".

I'd suggest you rethink your language design. If that's not possible you need to register a specialized ResourceDescriptionStrategy which 
creates EObjectDescriptions with some special user data (e.g. the referenceables in text form).

This is a prototype using current time millis:


class DescStrategy extends DefaultResourceDescriptionStrategy {
	@Override
	public boolean createEObjectDescriptions(EObject eObject,
			final IAcceptor<IEObjectDescription> acceptor) {
		return super.createEObjectDescriptions(eObject, new IAcceptor<IEObjectDescription>() {
			@Override
			public void accept(IEObjectDescription t) {
				acceptor.accept(EObjectDescription.create(t.getQualifiedName(), t.getEObjectOrProxy(), 
                                  Collections.singletonMap("hash", ""+System.currentTimeMillis())));
			}
		});
	}
}
Comment 8 Knut Wannheden CLA 2013-04-17 06:50:45 EDT
Although I haven't inspected your code, you may also want to take a look at how the XbaseResourceDescriptionStrategy works. It computes a "fingerprint" for exported objects. This will make sure that referencing resources are rebuilt as required.
Comment 9 Eclipse Webmaster CLA 2017-10-31 11:05:29 EDT
Requested via bug 522520.

-M.
Comment 10 Eclipse Webmaster CLA 2017-10-31 11:16:48 EDT
Requested via bug 522520.

-M.