From: ehilsdal Date: Tue, 11 Mar 2003 06:06:56 +0000 (+0000) Subject: Fix for X-Git-Tag: v1_1_0_RC1~35 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ae0ef30e2a9c8a4ef7ff59219b15b5109c956d22;p=aspectj.git Fix for Bugzilla Bug 32239 Dumps assembly code if Object[] used in args (BcelRenderer.java:152) Not surprisingly, this bug was fixed by lubbing an occurrence of ObjectType to ReferenceType, and then dispatching back for array types and/or class types going to BCEL. --- diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java b/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java index ea391c7e3..6642b1fc8 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java @@ -17,7 +17,7 @@ import org.apache.bcel.Constants; import org.apache.bcel.generic.InstructionFactory; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; -import org.apache.bcel.generic.ObjectType; +import org.apache.bcel.generic.ReferenceType; import org.apache.bcel.generic.Type; import org.aspectj.weaver.BCException; import org.aspectj.weaver.Member; @@ -167,7 +167,7 @@ public class BcelRenderer implements ITestVisitor, IExprVisitor { public void visit(Instanceof i) { instructions.insert(createJumpBasedOnBooleanOnStack()); instructions.insert( - Utility.createInstanceof(fact, (ObjectType) world.makeBcelType(i.getType()))); + Utility.createInstanceof(fact, (ReferenceType) world.makeBcelType(i.getType()))); i.getVar().accept(this); } diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java index 1fc189598..4d54a786e 100644 --- a/weaver/src/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java @@ -33,6 +33,7 @@ import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.InstructionTargeter; import org.apache.bcel.generic.LDC; import org.apache.bcel.generic.ObjectType; +import org.apache.bcel.generic.ArrayType; import org.apache.bcel.generic.ReferenceType; import org.apache.bcel.generic.SIPUSH; import org.apache.bcel.generic.TargetLostException; @@ -149,11 +150,14 @@ public class Utility { kind); } - public static Instruction createInstanceof(InstructionFactory fact, ObjectType t) { - return new INSTANCEOF(fact.getConstantPool().addClass(t)); + public static Instruction createInstanceof(InstructionFactory fact, ReferenceType t) { + int cpoolEntry = + (t instanceof ArrayType) + ? fact.getConstantPool().addArrayClass((ArrayType)t) + : fact.getConstantPool().addClass((ObjectType)t); + return new INSTANCEOF(cpoolEntry); } - public static Instruction createInvoke( InstructionFactory fact, LazyMethodGen m) {