Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Annoted Java generation broken in latest EMF?
Annoted Java generation broken in latest EMF? [message #1779518] Tue, 09 January 2018 07:05 Go to next message
Josh Jones is currently offline Josh JonesFriend
Messages: 2
Registered: January 2018
Junior Member
I recently updated my dev environment from Eclipse Mars to Oxygen, and with it moved from EMF 2.11.2 to EMF 2.13.0. Now when I try to reload/regenerate my model code from annotated Java, it doesn't work anymore.

Specifically, I have a model in project A:

package com.model.version
import org.eclipse.emf.ecore.EObject;

/**
 * @model abstract="true"
 */
public interface VersionedModel extends EObject {

	/**
	 * @model suppressedSetVisibility="true" default="0"
	 */
	public int getModelVersion();
}


and then a child model in project B: (This is important. It only seems to break when the child model is in a different project).

package com.ui.model.color;

import com.model.version.VersionedModel;

/**
 * @model abstract="true"
 */
public interface IColorPalette extends VersionedModel {
}


Once I generate my ecore models from my annotated java, and generate my code the result is that IColorPaletteImpl extends EObjectImpl, when it should be extending VersionedModelImpl.

This worked fine in our previous version of EMF, but stopped working with the new upgrade. Also, if I manually configure my Ecore model to define IColorPalette's supertype, the code generates correctly. However, as soon as I regenerate the Ecore model from the annotated java, it resets back again.

Is there some new detail in the latest versions of EMF that we're missing?


Re: Annoted Java generation broken in latest EMF? [message #1779716 is a reply to message #1779518] Thu, 11 January 2018 15:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
It's possible that some different behavior in JDT might break something. Certainly the code itself hasn't been touched to any significant extent for a long time. Please open a Bugzilla with a test case (preferably a zipped complete projects) that replicates the problem and I'll have a look.

Have you looked in the Ecore model itself? Is the representation wrong already in the *.ecore?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Annoted Java generation broken in latest EMF? [message #1779801 is a reply to message #1779716] Fri, 12 January 2018 21:25 Go to previous message
Josh Jones is currently offline Josh JonesFriend
Messages: 2
Registered: January 2018
Junior Member
I've posted the bug as you suggested here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=529776

There is indeed a difference between the ECORE generated by annotated java, and the ECORE that is manually configured.

Annotated Java version:
<?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="color" nsURI="http:///com/ui/model/color.ecore" nsPrefix="com.ui.model.color">
  <eClassifiers xsi:type="ecore:EClass" name="IColorPalette" abstract="true" eSuperTypes="#//VersionedModel"/>
  <eClassifiers xsi:type="ecore:EClass" name="VersionedModel" instanceClassName="com.model.version.VersionedModel"
      abstract="true" interface="true"/>
</ecore:EPackage>


Manually Configured version:
<?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="color" nsURI="http:///com/ui/model/color.ecore" nsPrefix="com.ui.model.color">
  <eClassifiers xsi:type="ecore:EClass" name="IColorPalette" abstract="true" eSuperTypes="../../com.model/model/version.ecore#//VersionedModel"/>
</ecore:EPackage>
Previous Topic:Hide a password attribute content
Next Topic:[CDO] Security aspects for access rights
Goto Forum:
  


Current Time: Thu Apr 25 13:49:36 GMT 2024

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

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

Back to the top