aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-06-19 23:13:28 +0000
committeraclement <aclement>2008-06-19 23:13:28 +0000
commit79af634638de58f454bc44e495781553dc96ef74 (patch)
tree5c486e065129b1afb364130af386da6bd09b70b4
parent3622fc1ed1039b3eedef38823b57160a05f7bac9 (diff)
downloadaspectj-79af634638de58f454bc44e495781553dc96ef74.tar.gz
aspectj-79af634638de58f454bc44e495781553dc96ef74.zip
yikes! address megabug. switch statements whose jump destinations were woven (apart from default) were incorrectly rewritten!
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java16
1 files changed, 13 insertions, 3 deletions
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);
}
}