Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Incompatible list features in Ecore(Creating Emfatic with Xtext)
Incompatible list features in Ecore [message #664704] Mon, 11 April 2011 16:13 Go to next message
James Williams is currently offline James WilliamsFriend
Messages: 27
Registered: July 2009
Junior Member
Hi there,

I'm trying to implement an Xtext version of Emfatic, but am coming across an issue that I'm not sure how to resolve, or whether it is even possible to...

A simplified version of my problem is below:
EClass:
 (  eAttributes+=EAttribute |
    eOperations+=EOperation |
    eReferences+=EReference )*
;

EAttribute:
    name=ID
;

EOperation:
    name=ID
;

EReference:
    name=ID
;


I'm getting an error on the eAttributes and eReferences assignments (but not for eOperations):

Quote:
Cannot find compatible feature eAttributes in sealed EClass EClass
from imported package http://www.eclipse.org/emf/2002/Ecore.


It seems that the problem is caused by the eAttributes collection not having the appropriate methods that the '+=' operator looks for. I found a previous thread with a similar problem ( http://www.eclipse.org/forums/index.php?t=msg&goto=43269), where the solution was to change the 'list' assignment to a 'feature' assignment and have the rule return the required type.

In this case, this doesn't seem to be possible as I can't return ELists (or, at least, I don't know how to).

Interestingly, the problem doesn't exist for the eOperations list. Looking into the implementation, eAttributes and eReferences are BasicEList<T>s and eOperations is simply an EList<T>. I guess the BasicEList type is causing the problem here? (changing 'eOperations' to 'eAllOperations', which is a BasicEList, causes the same problem to arise).

Does anyone know how I might be able to work around this issue?

Many thanks in advance.

James
Re: Incompatible list features in Ecore [message #664710 is a reply to message #664704] Mon, 11 April 2011 16:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

just have a look at the ecore metamodel: both are EStruturalFeatures Wink

EClass:
 (  eStructuralFeatures+=EAttribute |
    eOperations+=EOperation |
    eStructuralFeatures+=EReference )*
;



~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Incompatible list features in Ecore [message #664711 is a reply to message #664704] Mon, 11 April 2011 16:25 Go to previous message
James Williams is currently offline James WilliamsFriend
Messages: 27
Registered: July 2009
Junior Member
You sir, are a winner.

Thank you very much! Very Happy

-James
Previous Topic:[SOLVED] [Xtext 2] objects visible outside of their definition dsl files
Next Topic:Get Xtext log4j stack traces
Goto Forum:
  


Current Time: Thu Apr 25 19:53:57 GMT 2024

Powered by FUDForum. Page generated in 0.03197 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top