]> source.dussan.org Git - aspectj.git/commitdiff
133770 'call and ltw': now attempts to grab a delegate for a non-locally defined...
authoraclement <aclement>
Tue, 15 Aug 2006 09:58:18 +0000 (09:58 +0000)
committeraclement <aclement>
Tue, 15 Aug 2006 09:58:18 +0000 (09:58 +0000)
tests/ltw/callMunging/case1/HierMain.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml

diff --git a/tests/ltw/callMunging/case1/HierMain.java b/tests/ltw/callMunging/case1/HierMain.java
new file mode 100644 (file)
index 0000000..8fdb1c5
--- /dev/null
@@ -0,0 +1,28 @@
+import java.lang.reflect.Method;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.io.File;
+import org.aspectj.weaver.loadtime.WeavingURLClassLoader;
+
+public class HierMain {
+
+  public static void main(String []argv) {
+         try {
+                 System.out.println("into:main");
+                 ClassLoader baseLoader = HierMain.class.getClassLoader(); 
+                 URL base = baseLoader.getResource("HierMain.class");
+                 String urlstr = base.toExternalForm();
+                 int idx = urlstr.indexOf("classes.jar!");
+                 String sub = urlstr.substring("jar:".length(), idx)+"/sub.hiddenjar";
+                 URL subUrls[] = new URL[] { new URL(sub) };
+                 WeavingURLClassLoader loader = new WeavingURLClassLoader(subUrls, baseLoader);
+                 Class clazzA = Class.forName("A", false, loader);
+                 Method clazzAMethod = clazzA.getMethod("method",null);
+                 clazzAMethod.invoke(clazzA.newInstance(),null);
+                 System.out.println("leave:main");
+         } catch (Throwable t) {
+                 t.printStackTrace();
+         }
+  }
+  
+}
index afb9aeb5ef8c4cb94184ead5e241522544cd5e7f..38346279edc832c4f139ad2c7d44bcb70b35008d 100644 (file)
@@ -130,8 +130,8 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("aggressive ltw - decp - 2");
     }
     
-    public void testWeavingTargetOfCallAggressivelyInLTW_DeclareAnnotation_pr133770() {
-         runTest("aggressive ltw - deca");
+    public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_Hierarchy_pr133770() {
+      runTest("aggressive ltw - hierarchy");
     }
     
        public void testSeparateCompilationDeclareParentsCall_pr133770() {
index abd117964913780338f5c1e4b2739c38b4d8cfa9..1866789ef64288c93e8e61438dc2e9971add44ce 100644 (file)
       </run>
     </ajc-test>  
       
+    <ajc-test dir="ltw/callMunging/case1" title="aggressive ltw - hierarchy">
+      <compile files="T.java,HierMain.java" outjar="classes.jar"/>
+      <compile files="A.java" outjar="sub.hiddenjar" classpath="classes.jar"/>
+      <compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-Xlint:ignore"/>
+      <run class="HierMain" ltw="aop.xml">
+        <stdout>
+          <line text="into:main"/>
+          <line text="A.method() running"/>
+          <line text="advice running"/>
+          <line text="T.m1() running"/>
+          <line text="leave:main"/>
+        </stdout>
+      </run>
+    </ajc-test>  
+    
     <ajc-test dir="ltw/callMunging/case3" title="aggressive ltw - decp - 2">
       <compile files="A.java,T.java,S.java,Main.java" outjar="classes.jar"/>
       <compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-Xlint:ignore"/>