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

Bug 324432

Summary: Collision for newly created EMF model elements during transformation
Product: [Modeling] MMT.ATL Reporter: Aaron Ruß <aaron.russ>
Component: EngineAssignee: mmt-atl.toolkit-inbox <mmt-atl.toolkit-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

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).