Return-Path: X-Original-To: apmail-db-torque-dev-archive@www.apache.org Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C857C7BD6 for ; Sun, 27 Nov 2011 19:48:03 +0000 (UTC) Received: (qmail 53168 invoked by uid 500); 27 Nov 2011 19:48:03 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 53145 invoked by uid 500); 27 Nov 2011 19:48:03 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 53136 invoked by uid 99); 27 Nov 2011 19:48:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Nov 2011 19:48:03 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Nov 2011 19:48:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E39A2A2672 for ; Sun, 27 Nov 2011 19:47:39 +0000 (UTC) Date: Sun, 27 Nov 2011 19:47:39 +0000 (UTC) From: "Thomas Fox (Commented) (JIRA)" To: torque-dev@db.apache.org Message-ID: <668432339.15139.1322423259933.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (TORQUE-67) Code of the key objects in the package org.apache.torque.om needs review. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/TORQUE-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13157980#comment-13157980 ] Thomas Fox commented on TORQUE-67: ---------------------------------- Leave the type herarchy as it is because SimpleKey is the super type of all Keys containing a simple column. > 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 Fox > Assignee: Thomas Fox > 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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org