]> source.dussan.org Git - aspectj.git/commitdiff
Fix for pr104720: busted tableswitch on around advice weaving.
authoraclement <aclement>
Thu, 25 Aug 2005 11:35:49 +0000 (11:35 +0000)
committeraclement <aclement>
Thu, 25 Aug 2005 11:35:49 +0000 (11:35 +0000)
bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java
bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java
lib/bcel/bcel-src.zip
lib/bcel/bcel.jar

index 35e4aa468dd0ab44649ca3d5475b3fc1709a1dc2..fb030134d4a236bfef9a109dfa7589dde79ccba7 100644 (file)
@@ -59,7 +59,7 @@ package org.aspectj.apache.bcel.generic;
  * TABLESWITCH instruction, depending on whether the match values (int[]) can be
  * sorted with no gaps between the numbers.
  *
- * @version $Id: SWITCH.java,v 1.2 2004/11/19 16:45:19 aclement Exp $
+ * @version $Id: SWITCH.java,v 1.3 2005/08/25 11:35:49 aclement Exp $
  * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
 public final class SWITCH implements CompoundInstruction {
@@ -89,7 +89,11 @@ public final class SWITCH implements CompoundInstruction {
     this.targets = (InstructionHandle[])targets.clone();
 
     if((match_length = match.length) < 2) // (almost) empty switch, or just default
-      instruction = new TABLESWITCH(match, targets, target);
+      if (match.length==0) {
+         instruction = new LOOKUPSWITCH(match,targets,target);
+      } else {
+         instruction = new TABLESWITCH(match,targets,target);
+      }
     else {
       sort(0, match_length - 1);
       
index b934f369d34402ca073082de1328998c6cdfcf59..e40ef6890c7265e48d5a84be9ce54e9af72eddf5 100644 (file)
@@ -59,7 +59,7 @@ import org.aspectj.apache.bcel.util.ByteSequence;
 /** 
  * TABLESWITCH - Switch within given range of values, i.e., low..high
  *
- * @version $Id: TABLESWITCH.java,v 1.2 2004/11/19 16:45:19 aclement Exp $
+ * @version $Id: TABLESWITCH.java,v 1.3 2005/08/25 11:35:49 aclement Exp $
  * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  * @see SWITCH
  */
@@ -80,6 +80,10 @@ public class TABLESWITCH extends Select {
                     InstructionHandle target) {
     super(org.aspectj.apache.bcel.Constants.TABLESWITCH, match, targets, target);
     
+//    if (match_length==0) {
+//     throw new RuntimeException("A tableswitch with no targets should be represented as a LOOKUPSWITCH");
+//    }
+    
     length = (short)(13 + match_length * 4); /* Alignment remainder assumed
                                              * 0 here, until dump time */
     fixed_length = length;
@@ -98,6 +102,9 @@ public class TABLESWITCH extends Select {
     int high = (match_length > 0)? match[match_length - 1] : 0;
     out.writeInt(high);
 
+//  See aj bug pr104720
+//    if (match_length==0) out.writeInt(0); // following the switch you need to supply "HIGH-LOW+1" entries
+    
     for(int i=0; i < match_length; i++)     // jump offsets
       out.writeInt(indices[i] = getTargetOffset(targets[i]));
   }
index 27a0ff91fd451d3fcc7bbdc36b025e6e7947f130..846d3e557a0ce2698a964a91567aea6f940617af 100644 (file)
Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ
index 8fc0fb5827e40ed52d679d6b8f24e698a02ab1cc..f63428de54cd44e766392a638474924c4b457827 100644 (file)
Binary files a/lib/bcel/bcel.jar and b/lib/bcel/bcel.jar differ