Home » Modeling » EMF » Multiple Inheritance - Some mix-ins not created?
Multiple Inheritance - Some mix-ins not created? [message #553288] |
Tue, 17 August 2010 01:12 |
Kirsten M. Z. Messages: 132 Registered: July 2010 |
Senior Member |
|
|
Hi @all,
I have read through several documents and even some old posts on this forum about EMF and multiple inheritance. And, of course, I know the problems of mapping multiple inheritance to technical realization, e.g. Java code.
What I could get from the documents I found (please feel free to add references to more detailed material here), EMF model code generation is doing its best and creates mixins.
However, I wonder why my model code still has some unimplemented code (which means that I don't even get an placeholder). My unqualified assumption is that there is a problem with mixing a special category of references. However, it could be my fault, and my use case simply violates all rules again (*sigh*).
Stuff for reproducing the problem (Topcased 4.0.0 - Eclipse 3.6.0):
Ecore File:
------------
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
nsURI="test" nsPrefix="test">
<eClassifiers xsi:type="ecore:EClass" name="NewClass" eSuperTypes=" platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Mult iplicityElement platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Name dElement "/>
</ecore:EPackage>
GenModel File:
----------------
(default - no modification)
Now generate Model code.
Errors (Java Compiler):
-------------
Description Resource Path Location Type
The type NewClassImpl must implement the inherited abstract method NamedElement.createNameExpression(String, Type) NewClassImpl.java /TestProjekt/src/test/impl line 64 Java Problem
The type NewClassImpl must implement the inherited abstract method NamedElement.getClientDependency(String, boolean, EClass) NewClassImpl.java /TestProjekt/src/test/impl line 64 Java Problem
The type NewClassImpl must implement the inherited abstract method NamedElement.getClientDependency(String) NewClassImpl.java /TestProjekt/src/test/impl line 64 Java Problem
-------------
I would expect that the missing methods are at least generated in a form many others are, e.g.:
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getQualifiedName() {
// TODO: implement this method to return the 'Qualified Name' attribute
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
Regards,
Kirsten
|
|
|
Re: Multiple Inheritance - Some mix-ins not created? [message #553295 is a reply to message #553288] |
Tue, 17 August 2010 02:19 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Kirsten,
Comments below.
vultur wrote:
> Hi @all,
>
> I have read through several documents and even some old posts on this
> forum about EMF and multiple inheritance. And, of course, I know the
> problems of mapping multiple inheritance to technical realization,
> e.g. Java code.
>
> What I could get from the documents I found (please feel free to add
> references to more detailed material here), EMF model code generation
> is doing its best and creates mixins.
>
> However, I wonder why my model code still has some unimplemented code
> (which means that I don't even get an placeholder). My unqualified
> assumption is that there is a problem with mixing a special category
> of references. However, it could be my fault, and my use case simply
> violates all rules again (*sigh*).
>
> Stuff for reproducing the problem (Topcased 4.0.0 - Eclipse 3.6.0):
>
> Ecore File:
> ------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="NewClass" eSuperTypes="
> platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Mult
> iplicityElement
> platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Name dElement "/>
> </ecore:EPackage>
>
> GenModel File:
> ----------------
> (default - no modification)
>
> Now generate Model code.
>
> Errors (Java Compiler):
> -------------
>
> Description Resource Path Location Type
> The type NewClassImpl must implement the inherited abstract method
> NamedElement.createNameExpression(String, Type)
> NewClassImpl.java /TestProjekt/src/test/impl line 64 Java
> Problem
> The type NewClassImpl must implement the inherited abstract method
> NamedElement.getClientDependency(String, boolean, EClass)
> NewClassImpl.java /TestProjekt/src/test/impl line 64 Java
> Problem
> The type NewClassImpl must implement the inherited abstract method
> NamedElement.getClientDependency(String) NewClassImpl.java
> /TestProjekt/src/test/impl line 64 Java Problem
>
>
> -------------
>
> I would expect that the missing methods are at least generated in a
> form many others are, e.g.:
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public String getQualifiedName() {
> // TODO: implement this method to return the 'Qualified Name'
> attribute
> // Ensure that you remove @generated or mark it @generated NOT
> throw new UnsupportedOperationException();
> }
UML is generated from an extended GenModel so I think extensions of UML2
need to use that extended GenModel as well. Have a look at UML2's
GenModel. I think you can turn your existing *.genmodel into a UML2 one
just by changing the namespace of the xmlns declaration...
>
> Regards,
> Kirsten
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: Multiple Inheritance - Some mix-ins not created? [message #553459 is a reply to message #553395] |
Tue, 17 August 2010 15:07 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Kirsten,
I thought the details of how to extend UML2 were document somewhere. If
not, you'll need to ask about it on the UML2 newsgroup.
vultur wrote:
>> UML is generated from an extended GenModel so I think extensions of
>> UML2 need to use that extended GenModel as well. Have a look at
>> UML2's GenModel. I think you can turn your existing *.genmodel into a
>> UML2 one just by changing the namespace of the xmlns declaration...
>
> I changed the namespace to
> xmlns:genmodel="http://www.eclipse.org/uml2/2.2.0/GenModel"
>
> Then I was able to adjust some additional UML2 settings for
> generation... However, I was not able to generate working code,
> neither with the simple xmlns change, nor a complete customization of
> my *.genmodel file (and I checked the original uml.genmodel file for
> its settings). The more changes I made, the more errors I got. The
> method "createNameExpression", for example, has never been generated.
>
> In my opinion, only some step-by-step instructions would help me (and
> possibly some other people) generating their UML extensions.
> Otherwise, I am like a blind person stumbling in the darkness of
> hundreds of generation settings.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| | |
Goto Forum:
Current Time: Fri Apr 26 06:46:09 GMT 2024
Powered by FUDForum. Page generated in 0.04426 seconds
|