db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fischer (JIRA)" <j...@apache.org>
Subject [jira] Updated: (TORQUE-67) Code of the key objects in the package org.apache.torque.om needs review.
Date Sat, 24 Mar 2007 16:43:32 GMT

     [ https://issues.apache.org/jira/browse/TORQUE-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Thomas Fischer updated TORQUE-67:

    Component/s: Runtime

> Code of the key objects in the package org.apache.torque.om needs review.
> -------------------------------------------------------------------------
>                 Key: TORQUE-67
>                 URL: https://issues.apache.org/jira/browse/TORQUE-67
>             Project: Torque
>          Issue Type: Bug
>          Components: Runtime
>    Affects Versions: 3.2, 3.3
>            Reporter: Thomas Fischer
>            Priority: Minor
>             Fix For: 4.0
> Some of the equals() method violate the contract of Object.equals(): According to the
contract of equals()  in java.lang.object, equals() must be transitive, i.e. if objectA.equals(objectB)
== objectB.equals(objectA) must be true in all circumstances (except one of them is null,
of course), and the equals () method should not trow any exceptions. Both is not true e.g.
if obkjectA is a NumberKey and objectB is a String key. NumberKey throws a IllegalArgumentException
if compared to a StringKey, wheras if the comparison is turned round, false is returned.
> Also, if equals() is implemented, one should also implement hashCode()  which is not
done in stringKey.
> The code in the keys classes seems not be very good in general. For example, in DateKey.equals(),
it is checked whether key is a String , which cannot occur because every setter initializes
key with a date object. Another example:  SimpleKey (a key factory which has only static methods)
is in the class hierarchy of the key objects, which is very strange at least.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message