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

Bug 323069

Summary: [evaluator] OCL Interpreter Console does not compute indexOf() for enum
Product: [Modeling] OCL Reporter: Joern E. <joern_e>
Component: CoreAssignee: OCL Inbox <mdt-ocl-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: ed
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

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.