Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Multiple inheritance (from PackageableElement) and issues regarding the generated code
Multiple inheritance (from PackageableElement) and issues regarding the generated code [message #628112] Tue, 08 December 2009 14:25 Go to next message
Cristian Spiescu is currently offline Cristian SpiescuFriend
Messages: 79
Registered: July 2009

I have a custom metamodel that extends the UML2 metamodel.

I have a class Base that extends Element.
I have a class PackageableBase that extends Base and PackageableElement (in this order).

The generated PackageableBaseImpl extends BaseImpl. Because of the multiple inheritance, EMF generates inside my PackageableBaseImpl class:

* fields (and getters + setters) that are specific to PackageableElement: name, visibility, clientDependencies, etc. Until now everything is OK.
* eBaseStructuralFeatureID() that converts featureIDs from superclasses to featureIDs

Until now, everything is OK.

The only problem comes from the VISIBILITY field. In fact, the eGet, eSet ... family doesn't contain a proper CASE in its SWITCH (it does from all the other fields such as NAME, CLIENT_DEPENDENCY, etc). Because of this, when one of this methods is invoked with the VISIBILITY field (during COPY, or SAVE), the call is not properly managed, ending up with a NullPointerException.

I see in uml.ecore that PackageableElement has a "duplicates" annotation containing the "visibility" field, and perhaps this is related to my problem.

Perhaps there is an option during the UML-EMF conversion, or something else that could be specified to enforce the "correct" generation (as I wouldn't like to suppress the generated tag and modify the above methods (eSet, eIsSet, etc)).

Thank you in advance,

PS: I see that if my Base class extends from NamedElement instead of Element, I have no more problems.

But I cannot understand exactly why. Is it because the "visibility" field declared in PackageableElement "redefines" the "visibility" field declared in NamedElement, so when a class extends PackageableElement it should extend NamedElement as well?
Re: Multiple inheritance (from PackageableElement) and issues regarding the generated code [message #628138 is a reply to message #628112] Fri, 18 December 2009 04:36 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
This sounds like a "corner" case involving mixin inheritance and redefinitions which isn't handled very well by the UML2 code generator. Please open a bug.

Previous Topic:Multiple inheritance (from PackageableElement) and issues regarding the generated code
Next Topic:How to change label providers in UMLEditor?
Goto Forum:

Current Time: Sat Apr 21 04:07:39 GMT 2018

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

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