Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Bug: org.eclipse.ocl.ecore.QueryImpl breaks GC of org.eclipse.ocl.Query.evaluate(Object) breaks gene
Bug: org.eclipse.ocl.ecore.QueryImpl breaks GC of org.eclipse.ocl.Query.evaluate(Object) breaks gene [message #44182] Thu, 22 November 2007 07:36 Go to next message
Jörn Guy  Süß is currently offline Jörn Guy SüßFriend
Messages: 83
Registered: July 2009
Location: Germany
Member

This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C82D2E.3FAA73A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

The implementation of evaluate in=20
Object org.eclipse.ocl.ecore.QueryImpl.evaluate(Object)=20
breaks the general contract defined in
Object org.eclipse.ocl.Query.evaluate(Object)=20

The bold clause states that the result has to be a defined result type

In my case, resultType is:
org.eclipse.emf.ecore.impl.EClassImpl@1f36af6 (name: Component) =
(instanceClassName: null) (abstract: false, interface: false)

however, I get a result of:
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@7502f6 (eClass: =
org.eclipse.emf.ecore.impl.EClassImpl@15a349 (name: Invalid_Class) =
(instanceClassName: null) (abstract: false, interface: false))

which is not defined.

This should be caught by the implementation. Below the contract as =
specified in the API.

=20

evaluate
Object evaluate(Object obj)Evaluates the query on the object.=20

Parameters:=20
obj - an Object=20
Returns:=20
the result of the query, which may be one or more EObjects, Java =
objects, a mixture, or even null. In any case, the results conform to =
the expression's result type=20
See Also:=20
evaluate(), evaluate(List), resultType()








------=_NextPart_000_0006_01C82D2E.3FAA73A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16544" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT size=3D2><FONT face=3DArial>The implementation of evaluate in =

</FONT><FONT size=3D1></DIV>
<DIV><FONT face=3DArial size=3D2>Object=20
org.eclipse.ocl.ecore.QueryImpl.evaluate(Object)<FONT size=3D1>=20
</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>breaks the general contract defined=20
in</FONT></DIV><FONT face=3DArial size=3D1>
<DIV><FONT size=3D2>Object org.eclipse.ocl.Query.evaluate(Object)</FONT> =
</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>The bold clause states that the result has to be a =
defined=20
result type</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>In my case, resultType is:</FONT></DIV>
<DIV><FONT size=3D2>org.eclipse.emf.ecore.impl.EClassImpl@1f36af6 (name: =

Component) (instanceClassName: </FONT><B><FONT color=3D#7f0055=20
size=3D2>null</B></FONT><FONT size=3D2>) (</FONT><B><FONT =
color=3D#7f0055=20
size=3D2>abstract</B></FONT><FONT size=3D2>: </FONT><B><FONT =
color=3D#7f0055=20
size=3D2>false</B></FONT><FONT size=3D2>, </FONT><B><FONT =
color=3D#7f0055=20
size=3D2>interface</B></FONT><FONT size=3D2>: </FONT><B><FONT =
color=3D#7f0055=20
size=3D2>false</B></FONT><FONT size=3D2>)</DIV></FONT>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>however, I get a result of:</FONT></DIV>
<DIV><FONT size=3D2>
<P><FONT face=3DArial =
size=3D2>org.eclipse.emf.ecore.impl.DynamicEObjectImpl@7502f6=20
(eClass: org.eclipse.emf.ecore.impl.EClassImpl@15a349 (name: =
Invalid_Class)=20
(instanceClassName: null) (abstract: false, interface: =
false))</FONT></P>
<P>which is not defined.</P>
<P>This should be caught by the implementation. Below the contract as =
specified=20
in the API.</P>
<P></FONT></FONT></FONT></FONT><FONT face=3DArial =
size=3D2>&nbsp;</FONT></P></DIV>
<DIV>
<H3><FONT face=3DArial size=3D2>evaluate</FONT></H3><PRE><A =
title=3D"class or interface in java.lang" =
href=3D"http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html"><FON=
T face=3DArial size=3D2>Object</FONT></A><FONT face=3DArial size=3D2> =
evaluate(</FONT><A title=3D"class or interface in java.lang" =
href=3D"http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html"><FON=
T face=3DArial size=3D2>Object</FONT></A><FONT face=3DArial =
size=3D2>&nbsp;obj)</FONT></PRE>
<DL>
<DD><FONT face=3DArial size=3D2>Evaluates the query on the object. =
</FONT>
<P></P>
<DD>
<DL>
<DT><FONT face=3DArial size=3D2>Parameters: </FONT>
<DD><FONT face=3DArial size=3D2>obj - an Object </FONT>
<DT><FONT face=3DArial size=3D2>Returns: </FONT>
<DD><FONT face=3DArial size=3D2>the result of the query, which may =
be one or=20
more </FONT><A title=3D"class or interface in org.eclipse.emf.ecore" =

=
href=3D" http://127.0.0.1:64390/help/topic/org.eclipse.emf.doc/refere nces/=
javadoc/org/eclipse/emf/ecore/EObject.html"><FONT=20
face=3DArial size=3D2>EObject</FONT></A><FONT face=3DArial =
size=3D2>s, Java objects,=20
a mixture, or even null. <STRONG>In any case, the results conform to =
the=20
expression's </STRONG></FONT><A=20
=
href=3D" http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/=
javadoc/org/eclipse/ocl/Query.html#resultType()"><FONT=20
face=3DArial size=3D2><STRONG>result type</STRONG></FONT></A><FONT =
face=3DArial=20
size=3D2><STRONG> </STRONG></FONT>
<DT><FONT face=3DArial size=3D2>See Also: </FONT>
<DD><A=20
=
href=3D" http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/=
javadoc/org/eclipse/ocl/Query.html#evaluate()"><FONT=20
face=3DArial size=3D2>evaluate()</FONT></A><FONT face=3DArial =
size=3D2>, </FONT><A=20
=
href=3D" http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/=
javadoc/org/eclipse/ocl/Query.html#evaluate(java.util.List)" ><FONT=20
face=3DArial size=3D2>evaluate(List)</FONT></A><FONT face=3DArial =
size=3D2>,=20
</FONT><A=20
=
href=3D" http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/=
javadoc/org/eclipse/ocl/Query.html#resultType()"><FONT=20
face=3DArial size=3D2>resultType()</FONT></A></DD></DL></DD></DL>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P></DIV></BODY></HTML>

------=_NextPart_000_0006_01C82D2E.3FAA73A0--
Re: Bug: org.eclipse.ocl.ecore.QueryImpl breaks GC of org.eclipse.ocl.Query.evaluate(Object) breaks [message #44214 is a reply to message #44182] Thu, 22 November 2007 11:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------000704080507040003050907
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

J
Re: Bug: org.eclipse.ocl.ecore.QueryImpl breaks GC of org.eclipse.ocl.Query.evaluate(Object) breaks [message #44302 is a reply to message #44214] Thu, 22 November 2007 14:39 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Jörn, Ed,

Yes, OCL uses the OclInvalid token to indicate failure of evaluation (not
quite an exception object). It is actually defined as the sole instance of
the Invalid class which, in the OCL type system, is a specialization of
every other type and, therefore, by definition conforms to the result type
of the query expression.

Unfortunately, it is not practical to actually implement Invalid as a
dynamic Java class that implements all possible EMF-generated interfaces.

Clients should always first check the result of evaluation using the
OCL::isInvalid(Object) method to see whether it is the OclInvalid.

Please feel free to raise a bug for the Javadoc (a patch would be most
appreciated :-)

HTH,

Christian


Ed Merks wrote:

> Jörn,
>
> I don't know much about this, but it sounds me like an instance of this
> value is being returned likely to indicate that something has gone
> seriously wrong.
>
> /** The singleton instance of the <tt>Invalid</tt> standard
> library type. */
> public static final EObject OCL_INVALID =
> stdlibPackage.getEFactoryInstance().create(
> (EClass) stdlibPackage.getEClassifier("Invalid_Class"));
> //$NON-NLS-1$
>
> which is publicly accessible via OCLStandardLibrary:
>
> /**
> * Obtains the single instance of the {@link #getInvalid()
> Invalid} type,
> * identified by the token <tt>OclInvalid</tt>.
> *
> * @return the <tt>OclInvalid</tt> instance
> * (an instance of {@link #getInvalid() Invalid})
> */
> Object getOclInvalid();
>
> Probably the Javadoc should mention how error conditions are handled...
>
>
> Jörn Guy Süß wrote:
>> The implementation of evaluate in
>> Object org.eclipse.ocl.ecore.QueryImpl.evaluate(Object)
>> breaks the general contract defined in
>> Object org.eclipse.ocl.Query.evaluate(Object)
>>
>> The bold clause states that the result has to be a defined result type
>>
>> In my case, resultType is:
>> org.eclipse.emf.ecore.impl.EClassImpl@1f36af6 (name: Component)
>> (instanceClassName: *null*) (*abstract*: *false*, *interface*: *false*)
>>
>> however, I get a result of:
>>
>> org.eclipse.emf.ecore.impl.DynamicEObjectImpl@7502f6 (eClass:
>> org.eclipse.emf.ecore.impl.EClassImpl@15a349 (name: Invalid_Class)
>> (instanceClassName: null) (abstract: false, interface: false))
>>
>> which is not defined.
>>
>> This should be caught by the implementation. Below the contract as
>> specified in the API.
>>
>>
>>
>>
>> evaluate
>>
>> Object <http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html>
>> evaluate(Object
>> <http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html> obj)
>>
>> Evaluates the query on the object.
>>
>> Parameters:
>> obj - an Object
>> Returns:
>> the result of the query, which may be one or more EObject
>>
< http://127.0.0.1:64390/help/topic/org.eclipse.emf.doc/refere nces/javadoc/org/eclipse/emf/ecore/EObject.html>s,
>> Java objects, a mixture, or even null. *In any case, the
>> results conform to the expression's **result type*
>>
< http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/javadoc/org/eclipse/ocl/Query.html#resultType%28%29>*
>> *
>> See Also:
>> evaluate()
>>
< http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/javadoc/org/eclipse/ocl/Query.html#evaluate%28%29>,
>> evaluate(List)
>>
< http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/javadoc/org/eclipse/ocl/Query.html#evaluate%28java.util .List%29>,
>> resultType()
>>
< http://127.0.0.1:64390/help/topic/org.eclipse.ocl.doc/refere nces/javadoc/org/eclipse/ocl/Query.html#resultType%28%29>
>>
>>
>>
>>
>>
>>
>>
>>
>>
Previous Topic:ocl constraints' expression
Next Topic:Eclipse Corner Article: Implementing Model Integrity...
Goto Forum:
  


Current Time: Sat Dec 20 05:58:01 GMT 2014

Powered by FUDForum. Page generated in 0.01674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software