]> source.dussan.org Git - aspectj.git/commitdiff
yikes! address megabug. switch statements whose jump destinations were woven (apart...
authoraclement <aclement>
Thu, 19 Jun 2008 23:13:28 +0000 (23:13 +0000)
committeraclement <aclement>
Thu, 19 Jun 2008 23:13:28 +0000 (23:13 +0000)
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java

index 5d399885877aa3cdc15585c508b2fb21f550b25e..e87b2d2c9ea998ce31a59d612fa60511cd59c528 100644 (file)
@@ -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);
                    }
                }