Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 34069 invoked from network); 14 Oct 2009 11:50:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Oct 2009 11:50:54 -0000 Received: (qmail 6273 invoked by uid 500); 14 Oct 2009 11:50:54 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 6149 invoked by uid 500); 14 Oct 2009 11:50:54 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 6137 invoked by uid 99); 14 Oct 2009 11:50:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Oct 2009 11:50:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Oct 2009 11:50:52 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 45808234C045 for ; Wed, 14 Oct 2009 04:50:31 -0700 (PDT) Message-ID: <1797391017.1255521031268.JavaMail.jira@brutus> Date: Wed, 14 Oct 2009 04:50:31 -0700 (PDT) From: "Goran Hacek (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (COLLECTIONS-340) NOPClosure has a broken equals method In-Reply-To: <305043750.1255520791290.JavaMail.jira@brutus> 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/COLLECTIONS-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765525#action_12765525 ] Goran Hacek commented on COLLECTIONS-340: ----------------------------------------- None of the classes in "org.apache.commons.collections.functors" package implement equals() or hashCode() so why should NOPClosure be any different. I suggest removal of both equals() and hashCode() from NOPClosure. > NOPClosure has a broken equals method > ------------------------------------- > > Key: COLLECTIONS-340 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-340 > Project: Commons Collections > Issue Type: Bug > Components: Functor > Reporter: Goran Hacek > Priority: Minor > Fix For: Generics > > > Equals method of NOPClosure class doesn't follow objects equals contract. It isn't symmetric nor transitive and it is just plain wrong. > Following code evaluates to true on most (if not all) JVM implementations: > {noformat} NOPClosure.INSTANCE.equals(new Integer(System.identityHashCode(NOPClosure.INSTANCE))) {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.