Issue 15442: Primitive type values cannot be tested for equality using Reflection (mof2core-rtf) Source: (, ) Nature: Clarification Severity: Significant Summary: Reflection package of the MOF defines operation MOF::Element.equals(element:Object):Boolean for testing equality of model elements. Description of this function (on page 16) tells, that "For instances of DataType, returns true if the object has the same value as this Element instance." But instances of particular DataTypes (e.g. Integer, Bolean etc.) are just values (actually, I did not found, where exactly in MOF or UML Infrastructure specification, but somewhere I saw a definition of PrimitiveTypes like "instances of primitive types are identified only by their values"). So they are not Element-s (as I understand, they are Object-s, so each of primitive type, i.e. Integer, Boolean, String, UnlimitedNatural, can be considered as derived from Object, although they are not defined in such a way in MOF specification). As so, instances of primitive type has no operation "equals" (which is quite OK, as they should have no operations - for this reasons they are PrimitiveTypes). So we cannot call "equals" operation as member of e.g. Integer Object. So, we cannot compare two integer objects. Being more specific, let's cosider example (it is invalid call...): some_property.get(lower).equals(MOF::Factory.CreateFromString(integer, "1")) this test for equality (if lower bound of "some_property" equals to 1) is invalid, as "get" operation returns just number (value, instance of Integer), and it has not operation "equals". Note: in example above "some_property" is instance of MOF::Property, which represents some property of some class, and "lower" is either instance of MOF::Property, which represents lower bound of "some_proerty". "integer" is an instance of MOF::PrimitiveType meta-metaclass, which represents MOF::Integer meta-primitive-type. Actually, currently I have no Proposal for solution of this inconsistency, so this message is just report about it. Resolution: closed no change Revised Text: Actions taken: September 3, 2010: received issue April 6, 2015: closed issue Discussion: In version 2.4 and later, the equals() operation compares Objects, which includes instances of DataTypes. The existing text is clear about the behavior of equals() for both cases, comparing Elements or Data Values. End of Annotations:===== m: webmaster@omg.org Date: 03 Sep 2010 17:42:30 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Dmitry Semikin Employer: mailFrom: dmitry.semikin@gmail.com Terms_Agreement: I agree Specification: Meta Object Facility (MOF) Core Specification Section: 9 FormalNumber: formal/06-01-01 Version: 2.0 Doc_Year: 2006 Doc_Month: January Doc_Day: 01 Page: 15 Title: Primitive type values cannot be tested for equality using Reflection Nature: Clarification Severity: Significant CODE: 3TMw8 B1: Report Issue Description: Reflection package of the MOF defines operation MOF::Element.equals(element:Object):Boolean for testing equality of model elements. Description of this function (on page 16) tells, that "For instances of DataType, returns true if the object has the same value as this Element instance." But instances of particular DataTypes (e.g. Integer, Bolean etc.) are just values (actually, I did not found, where exactly in MOF or UML Infrastructure specification, but somewhere I saw a definition of PrimitiveTypes like "instances of primitive types are identified only by their values"). So they are not Element-s (as I understand, they are Object-s, so each of primitive type, i.e. Integer, Boolean, String, UnlimitedNatural, can be considered as derived from Object, although they are not defined in such a way in MOF specification). As so, instances of primitive type has no operation "equals" (which is quite OK, as they should have no operations - for this reasons they are PrimitiveTypes). So we cannot call "equals" operation as member of e.g. Integer Object. So, we cannot compare two integer objects. Being more specific, let's cosider example (it is invalid call...): some_property.get(lower).equals(MOF::Factory.CreateFromString(integer, "1")) this test for equality (if lower bound of "some_property" equals to 1) is invalid, as "get" operation returns just number (value, instance of Integer), and it has not operation "equals". Note: in example above "some_property" is instance of MOF::Property, which represents some property of some class, and "lower" is either instance of MOF::Property, which represents lower bound of "some_proerty". "integer" is an instance of MOF::PrimitiveType meta-metaclass, which represents MOF::Integer meta-primitive-type. Actually, currently I have no Proposal for solution of this inconsistency, so this message is just report about it.