Closed reteprelief closed 12 years ago
Here is the possible cause: the EcoreUtil Copier uses a hash table and the NumberValue has a hash function that results in the same key for different IntegerValue object with the same numeric value and unit. When filling in the references with copyReferences it simply walks the map and for each original object entry copies the references into the copied object. It does so only for the first instance with the same value and unit since all have the same key.
Problem was that IntegerLiteral methods equals and hashCode didn't call super methods.
If a property value has more than one integer or real with units, the units do not get copied correctly into the values in the instance model. The problem is with EcoreUtil.copy used making a copy of the value. Examples are range values or list of numeric values. It only seems to do it if the same numeric values occurs multiple times.