]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 109614
authoraclement <aclement>
Thu, 8 Dec 2005 11:43:16 +0000 (11:43 +0000)
committeraclement <aclement>
Thu, 8 Dec 2005 11:43:16 +0000 (11:43 +0000)
tests/bugs150/pr109614.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java

diff --git a/tests/bugs150/pr109614.java b/tests/bugs150/pr109614.java
new file mode 100644 (file)
index 0000000..d7f1eda
--- /dev/null
@@ -0,0 +1,13 @@
+public aspect pr109614 {  
+    Object around() : call( NoClassDefFoundError.new(..)) {
+      return proceed();
+    } 
+    
+    public static void main(String []argv) {
+       new ContractChecking();
+    }
+}    
+
+class ContractChecking {
+    public static final boolean enabled = Boolean.getBoolean(ContractChecking.class.getName());
+}
\ No newline at end of file
index 80bcd4907ab2a5d465be11d675bff765215ba833..4d40e12a9ba14bdca4e10b994841143e53a09ec1 100644 (file)
@@ -58,6 +58,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testAroundAdviceArrayAdviceSigs_pr118781()     { runTest("verify error with around advice array sigs");}
   public void testAtDeclareParents_pr117681() { runTest("at declare parents");}
   public void testPrivilegeProblem_pr87525() { runTest("privilege problem with switch");}
+  public void testRangeProblem_pr109614() { runTest("Range problem");}
   public void testGenericAspects_pr115237() { runTest("aspectOf and generic aspects");}
   public void testClassFormatError_pr114436() { runTest("ClassFormatError binary weaving perthis");}
   public void testParserException_pr115788() { runTest("parser exception");}
index 7729d879e0d30ac797962e7b5f6fee06c067dd35..1834c22f7440b0e2299f6d9e27e9c7e9136ab4a4 100644 (file)
                <compile files="PointcutLibrary.aj,ReflectOnAjcCompiledPointcuts.java" options="-1.5"></compile>
                <run class="ReflectOnAjcCompiledPointcuts" classpath="../lib/bcel/bcel.jar"/>
        </ajc-test>
+
        
        <ajc-test dir="compatibility/case1" title="generating code for a 1.2.1 runtime - 1">
                <compile files="Simple.java" options="-Xajruntimetarget:1.2"/>
                <run class="Pr103097"/>
        </ajc-test>
                    
+
+       <ajc-test dir="bugs150" title="Range problem">
+               <compile files="pr109614.java"/>
+               <run class="pr109614"/>
+       </ajc-test>
+           
     <ajc-test dir="bugs150/pr114436" title="ClassFormatError binary weaving perthis">
      <compile files="SimpleTrace.aj,ConcreteSimpleTracing.aj" outjar="aspects.jar"/>
      <compile files="TestClass.java" aspectpath="aspects.jar"/>
index 5ce739a8c89ea0eb99e8049022f65b1d488f91a8..d9ab3af72679fd3e4e996380652ae4dc1dfa08e6 100644 (file)
@@ -197,7 +197,7 @@ public class BcelShadow extends Shadow {
                        ih = ih.getPrev();
                }
                // now IH points to the NEW.  We're followed by the DUP, and that is followed
-               // by the actual instruciton we care about.  
+               // by the actual instruction we care about.  
                InstructionHandle newHandle = ih;
                InstructionHandle endHandle = newHandle.getNext();
                InstructionHandle nextHandle;
@@ -214,6 +214,7 @@ public class BcelShadow extends Shadow {
                                // XXX see next XXX comment
                                throw new RuntimeException("Unhandled kind of new " + endHandle);
                        }
+                       // Now make any jumps to the 'new', the 'dup' or the 'end' now target the nextHandle
                        retargetFrom(newHandle, nextHandle);
                        retargetFrom(dupHandle, nextHandle);
                        retargetFrom(endHandle, nextHandle);
@@ -237,7 +238,13 @@ public class BcelShadow extends Shadow {
                InstructionTargeter[] sources = old.getTargeters();
                if (sources != null) {
                        for (int i = sources.length - 1; i >= 0; i--) {
-                               sources[i].updateTarget(old, fresh);
+                               if (sources[i] instanceof ExceptionRange) {
+                                       ExceptionRange it = (ExceptionRange)sources[i];
+                                       System.err.println("...");
+                                       it.updateTarget(old,fresh,it.getBody());
+                               } else {
+                                 sources[i].updateTarget(old, fresh);
+                               }
                        }
                }
        }