Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324432 - Collision for newly created EMF model elements during transformation
Summary: Collision for newly created EMF model elements during transformation
Status: NEW
Alias: None
Product: MMT.ATL
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: mmt-atl.toolkit-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-03 10:57 EDT by Aaron Ruß CLA
Modified: 2010-09-03 10:57 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Ruß CLA 2010-09-03 10:57:25 EDT
this problem refers to the current implementation of 
org.eclipse.m2m.atl.drivers.emf4atl.ASMModel
(checkout date: 25.08.2010)

BACKGROUND:
To keep track of current EMF model elements, these are index by their corresponding EMF-objects (as keys) in a HashMap in the field 'modelElements' (in class ASMModel). 
Before adding newly created EMF model elements this map is queried, and in case there already is an entry for the corresponding EMF-object, the existing model element (as referenced by the HashMap) is used.

PROBLEM:
A problem occurs when several newly initialized EMF-objects of the same type are to be added as target-elements of a transformation, or more specifically, when they have not yet been modified/changed by the transformation: Since their hash-values are the same, querying the HashMap 'modelElements' for existing EMF model elements will return TRUE, although the EMF-objects should refer to different EMF model elements. Thus the same EMF model element will be used as target element for different source-EMF-objects during the transformation.

SOLUTION:
A quick solution to this problem would be, to use an IdentityHashMap for the field 'modelElements' (instead of a HashMap).