Bug 48321 - org.apache.bcel.generic.Instruction.equals(Object) does not follow Object.equals(Object) rules
Summary: org.apache.bcel.generic.Instruction.equals(Object) does not follow Object.equ...
Status: RESOLVED FIXED
Alias: None
Product: BCEL - Now in Jira
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.2
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: issues@commons.apache.org
URL:
Keywords:
Depends on:
Blocks:
 
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