From: aclement Date: Thu, 19 Jun 2008 23:13:28 +0000 (+0000) Subject: yikes! address megabug. switch statements whose jump destinations were woven (apart... X-Git-Tag: V1_6_1rc1~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=79af634638de58f454bc44e495781553dc96ef74;p=aspectj.git yikes! address megabug. switch statements whose jump destinations were woven (apart from default) were incorrectly rewritten! --- diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 5d3998858..e87b2d2c9 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -564,7 +564,13 @@ public final class LazyMethodGen implements Traceable { BodyPrinter(PrintStream out) { this.pool = enclosingClass.getConstantPool(); - this.body = getBody(); + this.body = getBodyForPrint(); + this.out = out; + } + + BodyPrinter(PrintStream out,InstructionList il) { + this.pool = enclosingClass.getConstantPool(); + this.body = il; this.out = out; } @@ -864,6 +870,9 @@ public final class LazyMethodGen implements Traceable { markAsChanged(); return body; } + public InstructionList getBodyForPrint() { + return body; + } public boolean hasBody() { if (savedMethod != null) return savedMethod.getCode() != null; @@ -1258,14 +1267,15 @@ public final class LazyMethodGen implements Traceable { if (branchInstruction instanceof InstructionSelect) { // Either LOOKUPSWITCH or TABLESWITCH - InstructionHandle[] targets = ((InstructionSelect)branchInstruction).getTargets(); + InstructionSelect iSelect = ((InstructionSelect)branchInstruction); + InstructionHandle[] targets = iSelect.getTargets(); for (int k = targets.length - 1; k >= 0; k--) { InstructionHandle oneTarget = targets[k]; if (handlesForDeletion.contains(oneTarget)) { do { oneTarget = oneTarget.getNext(); } while (handlesForDeletion.contains(oneTarget)); - branchInstruction.setTarget(oneTarget); + iSelect.setTarget(k,oneTarget); oneTarget.addTargeter(branchInstruction); } }