Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330073

Summary: [typesystem] Enable Xtend transformation for EMF Java types
Product: [Modeling] M2T Reporter: Karsten Thoms <karsten.thoms>
Component: XpandAssignee: Project Inbox <m2t.xpand-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3    
Version: 1.0.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Proposed Solution none

Description Karsten Thoms CLA 2010-11-12 06:20:30 EST
Xtend is not capable of instantiating EMF Java types in an Xtend transformation. The JavaBeansMetaModel assumes that classes have a default constructor, which is not true for EMF generated classes. If it is desired to instantiate EMF types the only possibility is to use the EMF typesystem.

Find attached a possible solution for this problem. The EMFJavaMetaModel extends the JavaMetaModel in a way that it is capable of instantiating EMF Java types. Therefore it is required to identify the EClass that corresonds to an EMF generated interface or implementation class. Through this the appropriate factory can be used to instantiate the type. Also the isAbstract() method should query the EClass. The EMFJavaMetaModel uses heuristics to locate the appropriate EClass for EMF generated types.

The implementation could be optimized by delegating functionality to the JavaTypeStrategy. Therefore the interface must by extended by two new methods
- newInstance()
- isAbstract
and the JavaTypeImpl should delegate to that (maybe subtyped specialized) interface.

The EDNA project makes use of this functionality. Find a transformation form UML to XSD using the XSD Infoset EMF implementation here:
http://www.edna-site.org/svn/trunk/rcp/org.edna.uml2xsd
Comment 1 Karsten Thoms CLA 2010-11-12 06:23:37 EST
Created attachment 182980 [details]
Proposed Solution
Comment 2 Karsten Thoms CLA 2020-04-30 13:54:31 EDT
This is a batch close of open M2T Xpand bugs. It is not planned work on this component in the foreseeable future. If you think this issue needs to be solved and you plan to contribute a fix then feel free to reopen it.