Bug 48321

Summary: org.apache.bcel.generic.Instruction.equals(Object) does not follow Object.equals(Object) rules
Product: BCEL - Now in Jira Reporter: Vít Šesták aka v6ak <org.apache-bugs-NO-PRIVATE-MAIL>
Component: MainAssignee: issues <issues>
Severity: normal CC: dbrosius
Priority: P2    
Version: 5.2   
Target Milestone: ---   
Hardware: All   
OS: All   

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