You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/28 01:14:46 UTC

svn commit: r1698244 - /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionComparator.java

Author: sebb
Date: Thu Aug 27 23:14:46 2015
New Revision: 1698244

URL: http://svn.apache.org/r1698244
Log:
BCEL-195 addition of hashCode() to generic/Instruction.java breaks Targeters. Never make BranchInstructions compare equal
Revert short-cut equality check because that would allow a single BI to be shared.

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionComparator.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionComparator.java?rev=1698244&r1=1698243&r2=1698244&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionComparator.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionComparator.java Thu Aug 27 23:14:46 2015
@@ -35,13 +35,10 @@ public interface InstructionComparator {
 
         @Override
         public boolean equals( Instruction i1, Instruction i2 ) {
-            if (i1 == i2) {
-                return true; // shortcut for identical objects
-            }
             if (i1.getOpcode() == i2.getOpcode()) {
                 if (i1 instanceof BranchInstruction) {
-                 // Different BIs are never equal to make targeters work correctly (BCEL-195)
-                    return false; // identity checked above
+                 // BIs are never equal to make targeters work correctly (BCEL-195)
+                    return false;
                 } else if (i1 instanceof ConstantPushInstruction) {
                     return ((ConstantPushInstruction) i1).getValue().equals(
                             ((ConstantPushInstruction) i2).getValue());