Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 183667 - Multi-valued features' values are not of the correct collection type
Summary: Multi-valued features' values are not of the correct collection type
Status: CLOSED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 1.1.0   Edit
Hardware: Other Linux
: P2 normal (vote)
Target Milestone: M7   Edit
Assignee: Christian Damus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-23 16:42 EDT by Christian Damus CLA
Modified: 2011-05-27 02:41 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 Christian Damus CLA 2007-04-23 16:42:00 EDT
The parsed AST of an OCL expression correctly interprets (it seems) the types of multi-valued operations and properties as OCL CollectionTypes of the appropriate kind.

However, in evaluation of an expression, the *values* of such operations and properties do not always conform.  In particular, they are often the original EList returned by eGet() or reflective invocation of Java methods.  Moreover, in the former case, manipulation of the resultant list actually modifies the model!

The values returned by OCL should always be copies of the original collection and be of the correct collection type:  Set, LinkedHashSet, Bag, or List.
Comment 1 Christian Damus CLA 2007-04-23 17:17:17 EDT
Updated the EcoreEvaluationEnvironment and UMLEvaluationEnvironment to coerce the results of operation calls and property navigation to the appropriate collection type (if a collection is warranted).

Note that the evaluation of OCL-defined operations and properties is unaffected, as they do not use the metamodel-specific reflection to obtain these values.

Added and/or updated JUnit tests to cover operation calls and property navigation for Ecore and for UML.
Comment 2 Nick Boldt CLA 2008-01-28 16:37:25 EST
Move to verified as per bug 206558.
Comment 3 Ed Willink CLA 2011-05-27 02:39:38 EDT
Closing after over a year in verified state.
Comment 4 Ed Willink CLA 2011-05-27 02:41:33 EDT
Closing after over a year in verified state.