]> source.dussan.org Git - aspectj.git/commitdiff
overweaving and tjp
authoraclement <aclement>
Thu, 13 May 2010 17:21:53 +0000 (17:21 +0000)
committeraclement <aclement>
Thu, 13 May 2010 17:21:53 +0000 (17:21 +0000)
12 files changed:
tests/features167/overweaving/callsTJP/A.aj [new file with mode: 0644]
tests/features167/overweaving/callsTJP/B.aj [new file with mode: 0644]
tests/features167/overweaving/callsTJP/Class1.java [new file with mode: 0644]
tests/features167/overweaving/callsTJP/Class2.java [new file with mode: 0644]
tests/features167/overweaving/callsTJP/aop.xml [new file with mode: 0644]
tests/features167/overweaving/getsetTJP/A.aj [new file with mode: 0644]
tests/features167/overweaving/getsetTJP/B.aj [new file with mode: 0644]
tests/features167/overweaving/getsetTJP/Class1.java [new file with mode: 0644]
tests/features167/overweaving/getsetTJP/Class2.java [new file with mode: 0644]
tests/features167/overweaving/getsetTJP/aop.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java
tests/src/org/aspectj/systemtest/ajc167/overweaving.xml

diff --git a/tests/features167/overweaving/callsTJP/A.aj b/tests/features167/overweaving/callsTJP/A.aj
new file mode 100644 (file)
index 0000000..87bbabf
--- /dev/null
@@ -0,0 +1,3 @@
+public aspect A {
+  before(): !cflow(adviceexecution()) && call(* *(..)) {System.out.println("A:"+thisJoinPoint);}
+}
diff --git a/tests/features167/overweaving/callsTJP/B.aj b/tests/features167/overweaving/callsTJP/B.aj
new file mode 100644 (file)
index 0000000..6c98536
--- /dev/null
@@ -0,0 +1,4 @@
+public aspect B {
+  declare precedence: B,*;
+  before(): !cflow(adviceexecution()) && call(* *(..)) {System.out.println("B:"+thisJoinPoint);}
+}
diff --git a/tests/features167/overweaving/callsTJP/Class1.java b/tests/features167/overweaving/callsTJP/Class1.java
new file mode 100644 (file)
index 0000000..c89605c
--- /dev/null
@@ -0,0 +1,5 @@
+public class Class1 {
+  public static void main(String[]argv) {
+    System.out.println("Class1.main");
+  }
+}
diff --git a/tests/features167/overweaving/callsTJP/Class2.java b/tests/features167/overweaving/callsTJP/Class2.java
new file mode 100644 (file)
index 0000000..b602a2f
--- /dev/null
@@ -0,0 +1,5 @@
+public class Class2 {
+  public static void main(String[]argv) {
+    System.out.println("Class2.main");
+  }
+}
diff --git a/tests/features167/overweaving/callsTJP/aop.xml b/tests/features167/overweaving/callsTJP/aop.xml
new file mode 100644 (file)
index 0000000..956854a
--- /dev/null
@@ -0,0 +1,12 @@
+<aspectj>
+<aspects>
+  <aspect name="A"/>
+  <aspect name="B"/>
+</aspects>
+<weaver options="-verbose -Xset:overWeaving=true -debug -showWeaveInfo">
+<!--
+  <dump within="*" beforeandafter="true"/>
+-->
+</weaver>
+
+</aspectj>
diff --git a/tests/features167/overweaving/getsetTJP/A.aj b/tests/features167/overweaving/getsetTJP/A.aj
new file mode 100644 (file)
index 0000000..85e5d1f
--- /dev/null
@@ -0,0 +1,3 @@
+public aspect A {
+  before(): !cflow(adviceexecution()) && get(* *) {System.out.println("A:"+thisJoinPoint);}
+}
diff --git a/tests/features167/overweaving/getsetTJP/B.aj b/tests/features167/overweaving/getsetTJP/B.aj
new file mode 100644 (file)
index 0000000..5c36c4a
--- /dev/null
@@ -0,0 +1,3 @@
+public aspect B {
+  before(): !cflow(adviceexecution()) && set(* *) {System.out.println("B:"+thisJoinPoint);}
+}
diff --git a/tests/features167/overweaving/getsetTJP/Class1.java b/tests/features167/overweaving/getsetTJP/Class1.java
new file mode 100644 (file)
index 0000000..029c8d8
--- /dev/null
@@ -0,0 +1,6 @@
+public class Class1 {
+  public static String message = "Class1.main";
+  public static void main(String[]argv) {
+    System.out.println(message);
+  }
+}
diff --git a/tests/features167/overweaving/getsetTJP/Class2.java b/tests/features167/overweaving/getsetTJP/Class2.java
new file mode 100644 (file)
index 0000000..5e3c6cf
--- /dev/null
@@ -0,0 +1,6 @@
+public class Class2 {
+  public static String message = "Class2.main";
+  public static void main(String[]argv) {
+    System.out.println(message);
+  }
+}
diff --git a/tests/features167/overweaving/getsetTJP/aop.xml b/tests/features167/overweaving/getsetTJP/aop.xml
new file mode 100644 (file)
index 0000000..956854a
--- /dev/null
@@ -0,0 +1,12 @@
+<aspectj>
+<aspects>
+  <aspect name="A"/>
+  <aspect name="B"/>
+</aspects>
+<weaver options="-verbose -Xset:overWeaving=true -debug -showWeaveInfo">
+<!--
+  <dump within="*" beforeandafter="true"/>
+-->
+</weaver>
+
+</aspectj>
index e29bd3349390e0575812dac7034b9ee39811dbf7..daff188425cad76d3ed837efaa67d50bf52869e1 100644 (file)
@@ -33,6 +33,10 @@ public class OverweavingTests extends org.aspectj.testing.XMLBasedAjcTestCase {
                runTest("getset - 2"); // testing what actually happens when overweaving
        }
 
+       public void testGetSetTjp1() {
+               runTest("getset - tjp - 1");
+       }
+
        public void testCalls1() {
                runTest("calls - 1"); // testing what should happen for calls
        }
@@ -41,6 +45,10 @@ public class OverweavingTests extends org.aspectj.testing.XMLBasedAjcTestCase {
                runTest("calls - 2"); // testing what actually happens when overweaving
        }
 
+       public void testCallsTjp1() {
+               runTest("calls - tjp - 1");
+       }
+
        public void testComplex() {
                runTest("really messy");
        }
index 159bcf77289aa58fff72c5957c5349d222ef140d..73f449aaac57eb7d0a54e6477c5f55ead1ee20e3 100644 (file)
@@ -2,7 +2,6 @@
 
 <suite>
    
-   
     <ajc-test dir="features167/overweaving/getset" title="getset - 1">
      <compile files="A.aj B.aj Class1.java Class2.java" options="-1.5"/>
      <run class="Class1">
        </stdout>
      </run>
    </ajc-test>
+     
+    <ajc-test dir="features167/overweaving/getsettjp" title="getset - tjp - 1">
+     <compile files="A.aj Class1.java" options="-1.5"/>
+     <compile files="B.aj" options="-1.5 -Xlint:ignore"/>
+     <compile files="Class2.java" options="-1.5 -Xlint:ignore"/>
+     <run class="Class1" ltw="aop.xml">
+       <stdout>
+       <!-- should be advised by both, but was *already* advised by A during first weave -->
+         <line text="B:set(String Class1.message)"/>
+         <line text="A:get(PrintStream java.lang.System.out)"/>
+         <line text="A:get(String Class1.message)"/>
+         <line text="Class1.main"/>
+       </stdout>
+     </run>
+     
+     <run class="Class2" ltw="aop.xml">
+       <stdout>
+         <line text="B:set(String Class2.message)"/>
+         <line text="A:get(PrintStream java.lang.System.out)"/>
+         <line text="A:get(String Class2.message)"/>
+         <line text="Class2.main"/>
+       </stdout>
+     </run>
+   </ajc-test>
    
     <ajc-test dir="features167/overweaving/calls" title="calls - 1">
      <compile files="A.aj B.aj Class1.java Class2.java" options="-1.5"/>
      </run>
    </ajc-test>
    
+    <ajc-test dir="features167/overweaving/callstjp" title="calls - tjp - 1">
+     <compile files="A.aj Class1.java" options="-1.5"/>
+     <compile files="B.aj" options="-1.5 -Xlint:ignore"/>
+     <compile files="Class2.java" options="-1.5 -Xlint:ignore"/>
+     <run class="Class1" ltw="aop.xml">
+       <stdout>
+       <!-- should be advised by both, but was *already* advised by A during first weave -->
+         <line text="A:call(void java.io.PrintStream.println(String))"/>
+         <line text="B:call(void java.io.PrintStream.println(String))"/>
+         <line text="Class1.main"/>
+       </stdout>
+     </run>
+     
+     <run class="Class2" ltw="aop.xml">
+       <stdout>
+         <line text="B:call(void java.io.PrintStream.println(String))"/>
+         <line text="A:call(void java.io.PrintStream.println(String))"/>
+         <line text="Class2.main"/>
+       </stdout>
+     </run>
+   </ajc-test>
+   
    <ajc-test dir="features167/overweaving/messy2" title="really messy">
      <compile files="A.aj Class1.java" options="-1.5"/>
      <compile files="B.aj" options="-1.5 -Xlint:ignore"/>