| Summary: | Missing validation in xtext grammar when importing existing metamodels | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sebastian Benz <sebastian.benz> | ||||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | clay, sebastian.zarnekow, sven.efftinge | ||||||
| Version: | 1.0.0 | Flags: | sebastian.zarnekow:
indigo+
|
||||||
| Target Milestone: | M6 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Sebastian Benz
Scheduled for M5 as grammar mixin and Ecore import will become more popular with Xbase. (In reply to comment #1) > Scheduled for M5 as grammar mixin and Ecore import will become more popular > with Xbase. thats because Sample.ecore refers to Ecore.ecore as platform:/plugin-uri <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass"/> instead of its ns-uri form <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EClass"/> should we add an additional check for this kind of errors see http://www.eclipse.org/forums/index.php?t=msg&goto=551227&S=b33a349f818bb2e41cfceb0b7048056b and http://www.eclipse.org/forums/index.php?t=msg&goto=540574&S=85734ae7f35dff9fae4e185c63d0dc08 (In reply to comment #2) > should we add an additional check for this kind of errors Yes. How would you do it? (In reply to comment #3) > (In reply to comment #2) > > should we add an additional check for this kind of errors > > Yes. How would you do it? I'd assume something along if (eClass.ePackage.nsURI == otherEClass.ePackage.nsURI && eClass.fragment == otherEClass.fragment && eClass.uri != otherEClass.uri) { ... } would work. (In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > should we add an additional check for this kind of errors > > > > Yes. How would you do it? > > I'd assume something along > > if (eClass.ePackage.nsURI == otherEClass.ePackage.nsURI && eClass.fragment == > otherEClass.fragment && eClass.uri != otherEClass.uri) { > ... > } > > would work. As for the other validation issues that cover misleading errors in the Xtext grammar editor, this would require changes in the grammar inference code. We could just check whether any EPackages are referenced twice instead of checking the EClass references. The EPackage reference should be flagged with an error not the EClass reference. Created attachment 188432 [details]
proposed patch pls review
Michael, I had to refactor the patch to support grammar inheritance. Pushed fix to master. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |