Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 281269 - [Xtend] EMF typesystem does not support EDataTypes
Summary: [Xtend] EMF typesystem does not support EDataTypes
Status: CLOSED FIXED
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: 0.7.0   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: M2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-23 15:17 EDT by Christian Damus CLA
Modified: 2013-02-21 08:10 EST (History)
2 users (show)

See Also:
sven.efftinge: helios+


Attachments
Fixes for datatype limitations (8.10 KB, patch)
2009-06-23 15:17 EDT, Christian Damus CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2009-06-23 15:17:12 EDT
Created attachment 139905 [details]
Fixes for datatype limitations

There are a number of problems in the EMF typesystem implementation that make it impossible to work with the values of EDataTypes in the Xtend language.  In particular, for EDataTypes that are not defined by Ecore (and therefore not statically mapped to Xtend's core type system):

  - values of an EDataType are always determined at runtime
    to be of type Object, so looking up features and operations
    that have the data type in their signature fails.  For example,
    invocation of a setPath(Path) operation always fails for my
    EDataType "Path" with an error message "Cannot find the operation
    setPath(Object) for ..."

  - exactly the same happens for the values of EEnums

  - similarly, run-time determination of the type of an operation
    argument that is an EList based on some data type fails because
    conversion of the value expects the list element type to be EList.
    For example, invocation of a setPaths(EList<Path>) operation
    (mutator for a "paths : Path [*]" feature) fails because the
    EmfListType::convert(...) method expects EList<EList>

In order to work around these problems, I have to create Java extensions to encapsulate everything I do with data type values.

I have attached a patch that makes data types work for me in my workflow.  Note that I am not attempting to implement support for data-type constructors as this would require changes to the Xtend expression grammar; I am relying on Java extensions for creation of new data-type values.  I am interested in maybe contributing such an enhancement in the future.

If you need a small-ish test case that manifests these problems, please comment and I will see what I can cook up.
Comment 1 Sven Efftinge CLA 2009-09-29 05:37:28 EDT
patch applied
Comment 2 Sven Efftinge CLA 2009-12-09 05:53:33 EST
The patch caused a significant performance drop (see #297053).
We decided to not support EDataType, but instead directly delegate to the Java type (instanceClassName). So you'll have to register the JavaBeansMetaModel in order to work with custom datatypes.
Comment 3 Karsten Thoms CLA 2013-02-21 08:10:28 EST
Bug resolved before Xpand 1.2 release date => Closing