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

Bug 329389

Summary: [evaluator] allInstances suspect on Abstract classes
Product: [Modeling] OCL Reporter: Ed Willink <ed>
Component: CoreAssignee: OCL Inbox <mdt-ocl-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: jos.warmer, robert.blust, stepper
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ed Willink CLA 2010-11-03 14:47:49 EDT
Eike Stepper reports that a customer got an exception while evaluating allInstances on an abstract class and asked whether use on abstract classes was valid.

The OCL specification specifies that allInstances returns instances of a classifier and its subtypes provide the number of instances is finite.

A quick examination of the evaluation code suggests that it finds only exact type matches, and so potentially returns null provoking the reported exception when an empty collection was expected.
Comment 1 Ed Willink CLA 2012-05-08 05:35:28 EDT
Just tried EModelElement.allInstances() on Ecore.ecore with both legacy and Xtext consoles. Both show lots of instances of the abstract class.
Comment 2 Ed Willink CLA 2013-02-15 05:47:19 EST
(In reply to comment #0)
> Eike Stepper reports that a customer got an exception while evaluating
> allInstances on an abstract class and asked whether use on abstract classes
> was valid.

 Bug 400907 raised against CDO.
Comment 3 Ed Willink CLA 2014-05-27 09:45:26 EDT
CLOSED after more than a year in RESOLVED state.
Comment 4 Ed Willink CLA 2014-05-27 09:53:07 EDT
and CLOSE