Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362985 - Polymorphisme doesn't work for EClass EReference
Summary: Polymorphisme doesn't work for EClass EReference
Status: CLOSED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.1   Edit
Hardware: All All
: P3 major
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 370343 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-06 06:15 EST by Sylvain Dudoit CLA
Modified: 2015-05-27 08:54 EDT (History)
2 users (show)

See Also:


Attachments
Sample illustrating the bug (32.51 KB, application/zip)
2011-11-06 06:15 EST, Sylvain Dudoit CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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