Bug 48321 - org.apache.bcel.generic.Instruction.equals(Object) does not follow Object.equals(Object) rules
org.apache.bcel.generic.Instruction.equals(Object) does not follow Object.equ...
Status: RESOLVED FIXED
Product: BCEL - Now in Jira
Classification: Unclassified
Component: Main
5.2
All All
: P2 normal
: ---
Assigned To: issues@commons.apache.org
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-12-01 08:18 UTC by Vít Šesták aka v6ak
Modified: 2011-03-13 14:45 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vít Šesták aka v6ak 2009-12-01 08:18:33 UTC
org.apache.bcel.generic.Instruction contains two strange methods: equals and setComparator. The equals and hashCode methods are by definition (see http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode%28%29 ) broken:
* If two Instruction objects have another InstructionComparator, they can be asymmetrically equal.
* If instructions aren't compared by identity (==), the inherited hashCode method is by definition broken.

I suggest: deprecate setComparator method.
Comment 1 Dave Brosius 2011-03-13 14:45:53 UTC
Agreed. deprecated
Committed revision 1081191