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

Bug 362985

Summary: Polymorphisme doesn't work for EClass EReference
Product: [Modeling] Acceleo Reporter: Sylvain Dudoit <sylvain.dudoit>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: stephane.begaudeau, yvan.lussaud
Version: 3.1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Sample illustrating the bug none

Description Sylvain Dudoit CLA 2011-11-06 06:15:42 EST
Created attachment 206496 [details]
Sample illustrating the bug

My metamodel :

  - Test
     - domain : EClass

I defined in my Acceleo templates queries for ENamedElement that should be usable for my EClass EReference.

  [query public getName(e : ENamedElement) : String = self.name + '-test' /]

  [template public generate(test : Test)]
  [comment @main/]
  Hello my domain class : [test.domain.getName()/]  // Error
  Hello my domain class : [getName(test.domain)/]   // Error
  Hello my domain class : [test.domain.oclAsType(ENamedElement).getName()/] // Ok
  Hello my domain class : [getName(test.domain.oclAsType(ENamedElement))/]  // Ok
  [/template]

The explicit cast is required to make it works.

Sylvain
Comment 1 Stephane Begaudeau CLA 2012-02-27 11:47:10 EST
The problem come from the ecore model that has the URI of the type EClass like this: "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass" and Acceleo/OCL which are using "http://www.eclipse.org/emf/2002/Ecore#//EClass".

An URI Handler has been put in place to convert the platform:/plugin path to the ns URI http://www during the loading of the meta-model from the workspace. The fix will be available in Acceleo 3.2.1 and Acceleo 3.3.0
Comment 2 Stephane Begaudeau CLA 2012-02-28 03:38:07 EST
Fix contributed on HEAD and R3_2_maintenance.
Comment 3 Stephane Begaudeau CLA 2012-02-28 03:51:58 EST
*** Bug 370343 has been marked as a duplicate of this bug. ***
Comment 4 Laurent Goubet CLA 2015-05-27 08:54:57 EDT
Closing resolved bugs