Skip to main content



      Home
Home » Modeling » EMF » EMF + Multiple inheritance with Interfaces
EMF + Multiple inheritance with Interfaces [message #1826794] Thu, 30 April 2020 11:37 Go to next message
Eclipse UserFriend
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="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="demo" nsURI="http://eclipse.org/demo" 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"/>
</ecore:EPackage>
Re: EMF + Multiple inheritance with Interfaces [message #1826801 is a reply to message #1826794] Thu, 30 April 2020 13:55 Go to previous message
Eclipse UserFriend
Hi

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.

Regards

Ed Willink

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


Current Time: Tue Jul 01 00:51:55 EDT 2025

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

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

Back to the top