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

Bug 370549

Summary: Cast shows error if one instance is of Type ecore::EObject
Product: [Modeling] M2T Reporter: Benjamin Schwertfeger <benjamin.schwertfeger>
Component: XpandAssignee: Karsten Thoms <karsten.thoms>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: karsten.thoms
Version: 1.1.0Flags: karsten.thoms: juno+
Target Milestone: M6   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Example with error none

Description Benjamin Schwertfeger CLA 2012-02-03 08:17:45 EST
Created attachment 210512 [details]
Example with error

If you have two Metamodels M1 and M2 with a reference in m1 to EObject, the Type in the EMF-Metamodel becomes ecore::EObject which is a emf::EObject, but not the same.

M1:
  Referencing:
    source: EObject

M2:
  CastErrror

with
«IMPORT m1»
«IMPORT m2»

«DEFINE test FOR m1::Referencing»
«((CastError)this.source).toString()»
«ENDDEFINE»

shows the error at the cast.

ecore::EObject should look like emf::EObject in this situation.
Comment 1 Karsten Thoms CLA 2012-02-03 08:26:07 EST
EClassType needed to treat the special case, when the EClassType represents ecore::EObject itself. In this case any EClassType must be assignable.

Overridden EClassType#internalIsAssignableFrom()
Added unit test EmfMetaModelTest#testIsAssignableFrom()
Comment 2 Karsten Thoms CLA 2013-02-21 08:13:49 EST
Bug resolved before Xpand 1.2 release date => Closing