1. Torque
  2. TORQUE-67

Code of the key objects in the package needs review.


    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.3
    • Fix Version/s: 4.0-beta1
    • Component/s: Runtime
    • Labels:


      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.


        Thomas Fox created issue -
        Thomas Fox made changes -
        Field Original Value New Value
        Component/s Runtime [ 12310808 ]
        Thomas Fox made changes -
        Assignee Thomas Fox [ tfischer ]
        Thomas Fox made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Thomas Fox made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Thomas Fox
            Thomas Fox
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: