Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364128 - [Xtend2] Refinement of Object's classes
Summary: [Xtend2] Refinement of Object's classes
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-18 04:50 EST by Hauke Fuhrmann CLA
Modified: 2011-11-18 05:04 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hauke Fuhrmann CLA 2011-11-18 04:50:19 EST
Build Identifier: 20110916-0149

As Xtend2 can be used very well as an M2M language, it would be very helpful to add the feature of refining objects in in-place transformations.

See discussion in ATL: http://hal.inria.fr/inria-00580033/en

Example: 
"B" extends "A".
"a" is an instance of "A".
In an in-place transformation one might want to refine "a" to be an instance of "B".

In EMF this is not yet supported directly. In Xtend2 this could be implemented by helping functions that
1. create a new instance of MySubClass
2. deep copy all properties and children of MyInstance
3. search and replace all references to MyInstance to the new copy

EcoreUtil.Copier and EcoreUtil.replace and EcoreUtil.UsageCrossReferencer might help to implement this quite straight forward (e.g. in some Xtend stdlib).

However, Xtend seems to have also internal references to the domain objects. For example the create-method-cache holds pointers to created elements. If they are refined after creation, the cache would have to be updated.

Another Example:
Man extends Human.
Woman extens Human.
Kim is instance of Human.
Only later in the process it gets known whether Kim is male or female, so a refinement to the corresponing more-detailed class should be done.

Rationale: Some Metamodels code information in attributes while others code it in subclasses (to better support polymorphy). This would make it much easier to convert those.

Reproducible: Always
Comment 1 Sebastian Zarnekow CLA 2011-11-18 05:04:24 EST
Closed as won't fix since we don't have any plans to provide more EMF specific M2M infrastructure. Clients are always free to use their own libraries and utilities that are tailored to their use cases.

Create extension are meant to be used as a basic caching / cyclic initialization mechanism thus it's your responsibility to clear that cache or to use sort of proxy instances that you return instead of the 'real' thing.