Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF + Multiple inheritance with Interfaces
EMF + Multiple inheritance with Interfaces [message #1826794] Thu, 30 April 2020 15:37 Go to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14352
Registered: July 2009
Senior Member
Given an Interface-EClass (abstract=true, interface=true) A
and an EClass B
Then for a second EClass C with Supertypes A + B

in the generated code CImpl wont inherit from BImpl

if C is with Supertypes B + A it will

is this a feature? or a bug?

for me it was at least a nice pitfall with custom impls in the Impl classes that suddenly got lost ;)

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="" xmlns:xsi=""
xmlns:ecore="" name="demo" nsURI="" nsPrefix="demo">
<eClassifiers xsi:type="ecore:EClass" name="SomeInterface" abstract="true" interface="true"/>
<eClassifiers xsi:type="ecore:EClass" name="SomeClass"/>
<eClassifiers xsi:type="ecore:EClass" name="SomeSubclass" eSuperTypes="#//SomeInterface #//SomeClass"/>

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: EMF + Multiple inheritance with Interfaces [message #1826801 is a reply to message #1826794] Thu, 30 April 2020 17:55 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7518
Registered: July 2009
Senior Member

From a pure modeling perspective it's probably a bug that runs into a Java limitation so for Java it's a feature.

When I hit the problem a few years go, I recall concluding that a smarter EMF genmodel might create more problems than the manual workarounds.

If you ensure that the most complicated inherited code is in the first superClass, you reduce the complexity of what you have to clone for the unsupported extra interfaces. You can perhaps share this in shared helper functions to avoid code drift.

If you wrap your Java code up as EAnnotation bodies, the auto-generation should spit the embedded Java out as many times as necessary.

Similarly if you use OCLinEcore (or I guess Xcore) to define the bodies that too should be multiply generated.


Ed Willink

Previous Topic:[CDO] Loading JAVA_CLASS CdoType -> ClassNotFoundException
Next Topic:[CDO] Connect to example standalone server
Goto Forum:

Current Time: Sun Oct 02 04:37:49 GMT 2022

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

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

Back to the top