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

Bug 363421

Summary: Cannot find compatible feature type in sealed EClass
Product: [Modeling] TMF Reporter: Karsten Thoms <karsten.thoms>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: 2.1.0Flags: sebastian.zarnekow: juno+
Target Milestone: M4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Screenshot none

Description Karsten Thoms CLA 2011-11-10 00:43:36 EST
Created attachment 206753 [details]
Screenshot

The Xtext Grammar Editor shows an error for a cross-reference, although the respective EClass does have an appropriate EReference.

Cannot find compatible feature type in sealed EClass MetaClass
   from imported package http://code.google.com/a/eclipselabs.org/p/spray:
   The existing reference 'type' has an incompatible type 'EClass'
   [org.eclipse.emf.ecore.EClass]. The expected type is 'EClass'.

The Ecore packages are imported with NS URI, as recommended.
   import "http://code.google.com/a/eclipselabs.org/p/spray"
   import "http://www.eclipse.org/emf/2002/Ecore" as ecore

The EReference uses also NS URI for the EReference:
  <eClassifiers xsi:type="ecore:EClass" name="MetaClass" eSuperTypes="#//SprayElement">
    <eStructuralFeatures xsi:type="ecore:EReference" name="type" lowerBound="1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EClass"/>
  </eClassifiers>
Comment 1 Karsten Thoms CLA 2011-11-10 00:45:58 EST
For reproduction use 
   git clone https://code.google.com/a/eclipselabs.org/p/spray/
and use tag "bug363421"
Comment 2 Sebastian Zarnekow CLA 2011-11-10 01:21:45 EST
As soon as you use something from the ecore.ecore which is not a EDatatype or EObject itself, you'll have to reference it via platform:/resource or platform:/plugin in your own ecore file. EDatatypes and EObject have a special role in EMF when it comes to assignability.

Could you please double check whether that works?

Will update the docs accordingly.
Comment 3 Karsten Thoms CLA 2011-11-10 02:32:33 EST
Changed this accordingly
  <eClassifiers xsi:type="ecore:EClass" name="MetaClass" eSuperTypes="#//SprayElement">
    <eStructuralFeatures xsi:type="ecore:EReference" name="type" lowerBound="1" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass"/>
  </eClassifiers>


The problem markers remain.

I had to add URI maps in the workflow to map the plugin resource URIs.

The reproducing tag has been updated.

If this is not an Xtext bug, but more a user bug, we can close the ticket here and discuss a solution in the forum.
Comment 4 Sebastian Zarnekow CLA 2011-11-10 03:49:15 EST
This is what we use in Xtext.ecore:

<eStructuralFeatures xsi:type="ecore:EReference" name="classifier" eType="ecore:EClass platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore#//EClassifier"/>

> For reproduction use 
>   git clone https://code.google.com/a/eclipselabs.org/p/spray/
> and use tag "bug363421"

I don't have enough credentials to clone from this location.
Comment 5 Karsten Thoms CLA 2011-11-10 09:20:07 EST
I can confirm that Xtext.xtext does not show these errors. Now I have tried to change the plugin URIs to platform resource URIs. No problem with generating EMF classes or run the Xtext generator, just UI problem.

We have a problem with Google Code at the moment so that the pages cannot be accessed without logging in with a Google Account. Thus, I am uploading the exported files now here:
http://dl.dropbox.com/u/662339/Exchange/Spray_bug363421.zip
Comment 6 Sebastian Zarnekow CLA 2011-11-10 15:54:28 EST
Fixed in master and maintenance
Comment 7 Karsten Thoms CLA 2017-09-19 17:04:35 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 8 Karsten Thoms CLA 2017-09-19 17:16:33 EDT
Closing all bugs that were set to RESOLVED before Neon.0