diff options
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionComparator.java | 73 | ||||
-rw-r--r-- | lib/bcel/bcel-src.zip | bin | 871029 -> 871079 bytes | |||
-rw-r--r-- | lib/bcel/bcel.jar | bin | 593997 -> 594005 bytes |
3 files changed, 38 insertions, 35 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionComparator.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionComparator.java index 7f9b116f1..029952887 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionComparator.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionComparator.java @@ -64,46 +64,49 @@ package org.aspectj.apache.bcel.generic; * instructions must have the same target. * * @see Instruction - * @version $Id: InstructionComparator.java,v 1.2 2004/11/19 16:45:19 aclement Exp $ + * @version $Id: InstructionComparator.java,v 1.3 2005/09/21 16:28:36 acolyer Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ public interface InstructionComparator { - public static final InstructionComparator DEFAULT = - new InstructionComparator() { - public boolean equals(Instruction i1, Instruction i2) { - if(i1.opcode == i2.opcode) { - if(i1 instanceof Select) { - InstructionHandle[] t1 = ((Select)i1).getTargets(); - InstructionHandle[] t2 = ((Select)i2).getTargets(); + public static final InstructionComparator DEFAULT = new InstructionComparator() { + public boolean equals(Instruction i1, Instruction i2) { + if (i1.opcode == i2.opcode) { + if (i1 instanceof Select) { + InstructionHandle[] t1 = ((Select) i1).getTargets(); + InstructionHandle[] t2 = ((Select) i2).getTargets(); - if(t1.length == t2.length) { - for(int i = 0; i < t1.length; i++) { - if(t1[i] != t2[i]) { - return false; - } - } - - return true; - } - } else if(i1 instanceof BranchInstruction) { - return ((BranchInstruction)i1).target == - ((BranchInstruction)i2).target; - } else if(i1 instanceof ConstantPushInstruction) { - return ((ConstantPushInstruction)i1).getValue(). - equals(((ConstantPushInstruction)i2).getValue()); - } else if(i1 instanceof IndexedInstruction) { - return ((IndexedInstruction)i1).getIndex() == - ((IndexedInstruction)i2).getIndex(); - } else if(i1 instanceof NEWARRAY) { - return ((NEWARRAY)i1).getTypecode() == ((NEWARRAY)i2).getTypecode(); - } else { - return true; - } - } + // See AspectJ bug 104957 + if (t1 == null && t2 == null) return true; + if (t1 == null || t2 == null) return false; + + if (t1.length == t2.length) { + for (int i = 0; i < t1.length; i++) { + if (t1[i] != t2[i]) { + return false; + } + } - return false; - } - }; + return true; + } + } else if (i1 instanceof BranchInstruction) { + return ((BranchInstruction) i1).target == ((BranchInstruction) i2).target; + } else if (i1 instanceof ConstantPushInstruction) { + return ((ConstantPushInstruction) i1).getValue().equals( + ((ConstantPushInstruction) i2).getValue()); + } else if (i1 instanceof IndexedInstruction) { + return ((IndexedInstruction) i1).getIndex() == ((IndexedInstruction) i2) + .getIndex(); + } else if (i1 instanceof NEWARRAY) { + return ((NEWARRAY) i1).getTypecode() == ((NEWARRAY) i2) + .getTypecode(); + } else { + return true; + } + } + + return false; + } + }; public boolean equals(Instruction i1, Instruction i2); } diff --git a/lib/bcel/bcel-src.zip b/lib/bcel/bcel-src.zip Binary files differindex e2980fb18..59543ed9b 100644 --- a/lib/bcel/bcel-src.zip +++ b/lib/bcel/bcel-src.zip diff --git a/lib/bcel/bcel.jar b/lib/bcel/bcel.jar Binary files differindex ddea0d353..0d2474e5f 100644 --- a/lib/bcel/bcel.jar +++ b/lib/bcel/bcel.jar |