|
Re: Ecore code generation strategy using inheritance [message #890498 is a reply to message #890475] |
Fri, 22 June 2012 12:31 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Mark,
Comments below.
On 22/06/2012 7:40 AM, Mark Hoffmann wrote:
> Hi all,
>
> I have a question regarding the code generation for multi-inheritance.
> I have an ecore
> With three classes AClass, ASuperClass, BInterface. AClass has as
> super types: ASuperClass and BInterface. The classifiers look like this.
>
> <eClassifiers xsi:type="ecore:EClass" name="AClass"
> eSuperTypes="#//BInterface #//ASuperClass"/>
> <eClassifiers xsi:type="ecore:EClass" name="ASuperClass"/>
> <eClassifiers xsi:type="ecore:EClass" name="BInterface"
> abstract="true" interface="true"/>
>
> If I generate the code, AClassImpl looks like this:
> public class AClassImpl extends EObjectImpl implements AClass { ... } and
> public interface AClass extends ASuperClass, BInterface { ... }
>
> I expected:
>
> public class AClassImpl extends ASuperClassImpl implements AClass {
> ... } because ASuperClass contains some modified code.
>
> I only got the last result by changing the order of the super types in
> AClass:
>
> <eClassifiers xsi:type="ecore:EClass" name="AClass"
> eSuperTypes="#//ASuperClass #//BInterface"/>
>
> Can anyone explain me, if this is expected behavior. After e few
> discussions with my colleagues I am not really sure anymore, if this
> is bug or feature.
As you've noticed, it will generate the base class choice purely
depending on the order of the eSuperTypes.
Perhaps the generator could be a little smarter in this particular case,
but it's trivial for you to order the inheritance to produce the result
you want.
>
> Can anyone give me a hint?
>
> Regards,
> Mark
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04064 seconds