Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350392 - collectNested returns Bag rather than Sequence for ordered collection
Summary: collectNested returns Bag rather than Sequence for ordered collection
Status: NEW
Alias: None
Product: Acceleo
Classification: Modeling
Component: Documentation (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows Vista
: P3 minor
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-27 00:51 EDT by Ed Willink CLA
Modified: 2016-04-04 04:12 EDT (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 Ed Willink CLA 2011-06-27 00:51:35 EDT
3.1 (Not available as a Bugzilla option)

The definition of collectNested in the Acceleo documentation is wrong.

The overloads of collectNested for Sequence and OrderedSet to return Sequence are missing.

The overloads of collectNested for Bag and Set to return Bag are missing.

The implementation appears to return Bag for all Collection kinds which makes it impossible to map one ordered collection to another.

[A quick check of the OCL implementation suggests that this is an Acceleo rather than OCL bug.]
Comment 1 Ed Willink CLA 2011-06-27 01:06:46 EDT
Correction: It's just the documentation that's wrong.

[My source was a Set rather than an OrderedSet.]
Comment 2 Laurent Goubet CLA 2011-07-18 04:52:44 EDT
The documentation as a whole needs a good maintenance, thanks for highlighting this one.
Comment 3 Ed Willink CLA 2011-07-18 05:26:58 EDT
You may want to leverage the Acceleo transformation that generates the Indigo OCL Standard Library documentation from the candidate OMG OCL Standard Library model.

I should get time in the next couple of months to provide OCL 2.4 models and resolutions at which point the Acceleo templates to auto-gen the specification should be re-useab;e for other purposes.
Comment 4 Laurent Goubet CLA 2016-04-04 03:57:50 EDT
The documentation of Acceleo mentions that "The type of the resulting collection depends on the type of self."

However, the first line of the documentation for the content assist indeed mentions that the signature is "Bag(T2) collectNested(OclExpression expr)" even on an OrderedSet self.

This is due to the oclstdlib incorrectly describing the operation.

org.eclipse.ocl.ecore/model/oclstdlib.ecore has "OrderedSet(T)_Class.collectNested(OclExpression) : Bag(T2)". The EvaluationVisitorImpl, however, correctly uses an ArrayList (Sequence) for the result of this call.
Comment 5 Ed Willink CLA 2016-04-04 04:12:06 EDT
(In reply to Laurent Goubet from comment #2)
> The documentation as a whole needs a good maintenance, thanks for
> highlighting this one.

The Acceleo issue to be addressed. Returning this Bug to Acceleo.

(In reply to Laurent Goubet from comment #4)
> This is due to the oclstdlib incorrectly describing the operation.

An OCL bug to be addressed. Bug 490982 raised.