Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323069 - [evaluator] OCL Interpreter Console does not compute indexOf() for enum
Summary: [evaluator] OCL Interpreter Console does not compute indexOf() for enum
Status: CLOSED WONTFIX
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-18 13:24 EDT by Joern E. CLA
Modified: 2013-05-20 11:38 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 Joern E. CLA 2010-08-18 13:24:32 EDT
Build Identifier: 20100617-1415

Trying to get the ordinal for an enum using EnumType.allInstances()->asSequence()->indexOf(...) does not compute in the OCL Interpreter Console (empty result). It does for other types.
See http://www.eclipse.org/forums/index.php?t=msg&th=173931&start=0&S=79151d79cb376a55a724e7980d46d1c7 for details.

Reproducible: Always

Steps to Reproduce:
1. Define enum EnumType with at least Literal as element
2. Compute EnumType.allInstances()->asSequence()->indexOf(EnumType::Literal)
Comment 1 Ed Willink CLA 2011-05-04 14:59:38 EDT
CollectionKind.allInstances()->asSequence()->indexOf(CollectionKind::Set) works in the pivot evaluator.

I looked at changing the modelled:

type Enumeration conformsTo OclAny {
	static operation allInstances<OclSelf>() : Set<OclSelf>;
}

to OrderedSet, but now I realise that this is a total specification fudge corresponding to the implementation fudge that was required to make it 'work'.

An enumeration literal is an EnumerationLiteral not an Enumeration (cf a property is a Property not a Class).

CollectionKind.ownedLiteral->indexOf(CollectionKind::Set)

also works and is semantically sensible.

I think that Enumeration::allInstances() should be retracted.

WONTFIX: Bugzilla only remains open to raise an OMG Issue.
Comment 2 Ed Willink CLA 2011-11-08 12:02:41 EST
OMG Issue 15420 raised.
Comment 3 Ed Willink CLA 2013-05-20 11:38:11 EDT
CLOSED after a year in the RESOLVED state.