diff options
Diffstat (limited to 'tests/ltw/callMunging')
26 files changed, 194 insertions, 0 deletions
diff --git a/tests/ltw/callMunging/A.java b/tests/ltw/callMunging/A.java new file mode 100644 index 000000000..3c15ddb4c --- /dev/null +++ b/tests/ltw/callMunging/A.java @@ -0,0 +1,7 @@ +public class A { + S s = new S(); + public void method() { + System.out.println("A.method() running"); + s.m1(); + } +} diff --git a/tests/ltw/callMunging/B.java b/tests/ltw/callMunging/B.java new file mode 100644 index 000000000..80bdb9c98 --- /dev/null +++ b/tests/ltw/callMunging/B.java @@ -0,0 +1,7 @@ +public class B { + T t = new T(); + public void method() { + System.out.println("B.method() running"); + t.m2(); + } +} diff --git a/tests/ltw/callMunging/Main.java b/tests/ltw/callMunging/Main.java new file mode 100644 index 000000000..94e395eb9 --- /dev/null +++ b/tests/ltw/callMunging/Main.java @@ -0,0 +1,21 @@ +import java.lang.reflect.Method; + +public class Main { + + public static void main(String []argv) { + try { + System.out.println("into:main"); + Class clazzA = Class.forName("A"); + Method clazzAMethod = clazzA.getMethod("method",null); + clazzAMethod.invoke(clazzA.newInstance(),null); + + Class clazzB= Class.forName("B"); + Method clazzBMethod = clazzB.getMethod("method",null); + clazzBMethod.invoke(clazzB.newInstance(),null); + System.out.println("leave:main"); + } catch (Throwable t) { + t.printStackTrace(); + } + } + +} diff --git a/tests/ltw/callMunging/T.java b/tests/ltw/callMunging/T.java new file mode 100644 index 000000000..1a9a84a8e --- /dev/null +++ b/tests/ltw/callMunging/T.java @@ -0,0 +1,6 @@ +public class T { + + public void m1() {System.out.println("T.m1() running");} + public void m2() {System.out.println("T.m2() running");} + +} diff --git a/tests/ltw/callMunging/X.java b/tests/ltw/callMunging/X.java new file mode 100644 index 000000000..836aa7bbf --- /dev/null +++ b/tests/ltw/callMunging/X.java @@ -0,0 +1,9 @@ +import java.io.Serializable; + +public aspect X { + declare parents: T implements Serializable; + + before(): call(* Serializable+.m*(..)) { + System.out.println("advice running"); + } +} diff --git a/tests/ltw/callMunging/aop.xml b/tests/ltw/callMunging/aop.xml new file mode 100644 index 000000000..321117898 --- /dev/null +++ b/tests/ltw/callMunging/aop.xml @@ -0,0 +1,7 @@ +<aspectj> +<weaver options="-showWeaveInfo -verbose"/> +<aspects> +<aspect name="X"/> +</aspects> +</aspectj> + diff --git a/tests/ltw/callMunging/case1/A.java b/tests/ltw/callMunging/case1/A.java new file mode 100644 index 000000000..23950c6a2 --- /dev/null +++ b/tests/ltw/callMunging/case1/A.java @@ -0,0 +1,7 @@ +public class A { + T t = new T(); + public void method() { + System.out.println("A.method() running"); + t.m1(); + } +} diff --git a/tests/ltw/callMunging/case1/Main.java b/tests/ltw/callMunging/case1/Main.java new file mode 100644 index 000000000..8466ce953 --- /dev/null +++ b/tests/ltw/callMunging/case1/Main.java @@ -0,0 +1,17 @@ +import java.lang.reflect.Method; + +public class Main { + + public static void main(String []argv) { + try { + System.out.println("into:main"); + Class clazzA = Class.forName("A"); + Method clazzAMethod = clazzA.getMethod("method",null); + clazzAMethod.invoke(clazzA.newInstance(),null); + System.out.println("leave:main"); + } catch (Throwable t) { + t.printStackTrace(); + } + } + +} diff --git a/tests/ltw/callMunging/case1/T.java b/tests/ltw/callMunging/case1/T.java new file mode 100644 index 000000000..9e177ba89 --- /dev/null +++ b/tests/ltw/callMunging/case1/T.java @@ -0,0 +1,3 @@ +public class T { + public void m1() {System.out.println("T.m1() running");} +} diff --git a/tests/ltw/callMunging/case1/X.java b/tests/ltw/callMunging/case1/X.java new file mode 100644 index 000000000..836aa7bbf --- /dev/null +++ b/tests/ltw/callMunging/case1/X.java @@ -0,0 +1,9 @@ +import java.io.Serializable; + +public aspect X { + declare parents: T implements Serializable; + + before(): call(* Serializable+.m*(..)) { + System.out.println("advice running"); + } +} diff --git a/tests/ltw/callMunging/case1/aop.xml b/tests/ltw/callMunging/case1/aop.xml new file mode 100644 index 000000000..321117898 --- /dev/null +++ b/tests/ltw/callMunging/case1/aop.xml @@ -0,0 +1,7 @@ +<aspectj> +<weaver options="-showWeaveInfo -verbose"/> +<aspects> +<aspect name="X"/> +</aspects> +</aspectj> + diff --git a/tests/ltw/callMunging/case1/readme.txt b/tests/ltw/callMunging/case1/readme.txt new file mode 100644 index 000000000..c3c00dd9f --- /dev/null +++ b/tests/ltw/callMunging/case1/readme.txt @@ -0,0 +1 @@ +Basic case, where type T needs munging with a declare parents before the join point in A.method() are matched.
\ No newline at end of file diff --git a/tests/ltw/callMunging/case2/A.java b/tests/ltw/callMunging/case2/A.java new file mode 100644 index 000000000..23950c6a2 --- /dev/null +++ b/tests/ltw/callMunging/case2/A.java @@ -0,0 +1,7 @@ +public class A { + T t = new T(); + public void method() { + System.out.println("A.method() running"); + t.m1(); + } +} diff --git a/tests/ltw/callMunging/case2/Main.java b/tests/ltw/callMunging/case2/Main.java new file mode 100644 index 000000000..8466ce953 --- /dev/null +++ b/tests/ltw/callMunging/case2/Main.java @@ -0,0 +1,17 @@ +import java.lang.reflect.Method; + +public class Main { + + public static void main(String []argv) { + try { + System.out.println("into:main"); + Class clazzA = Class.forName("A"); + Method clazzAMethod = clazzA.getMethod("method",null); + clazzAMethod.invoke(clazzA.newInstance(),null); + System.out.println("leave:main"); + } catch (Throwable t) { + t.printStackTrace(); + } + } + +} diff --git a/tests/ltw/callMunging/case2/MarkerAnnotation.java b/tests/ltw/callMunging/case2/MarkerAnnotation.java new file mode 100644 index 000000000..f580bbe47 --- /dev/null +++ b/tests/ltw/callMunging/case2/MarkerAnnotation.java @@ -0,0 +1,3 @@ +import java.lang.annotation.*; + +public @interface MarkerAnnotation {}
\ No newline at end of file diff --git a/tests/ltw/callMunging/case2/T.java b/tests/ltw/callMunging/case2/T.java new file mode 100644 index 000000000..9e177ba89 --- /dev/null +++ b/tests/ltw/callMunging/case2/T.java @@ -0,0 +1,3 @@ +public class T { + public void m1() {System.out.println("T.m1() running");} +} diff --git a/tests/ltw/callMunging/case2/X.java b/tests/ltw/callMunging/case2/X.java new file mode 100644 index 000000000..0be7aa1e4 --- /dev/null +++ b/tests/ltw/callMunging/case2/X.java @@ -0,0 +1,9 @@ +import java.io.Serializable; + +public aspect X { + declare @type: T: @MarkerAnnotation; + + before(): call(* (@MarkerAnnotation *).m*(..)) { + System.out.println("advice running"); + } +} diff --git a/tests/ltw/callMunging/case2/aop.xml b/tests/ltw/callMunging/case2/aop.xml new file mode 100644 index 000000000..321117898 --- /dev/null +++ b/tests/ltw/callMunging/case2/aop.xml @@ -0,0 +1,7 @@ +<aspectj> +<weaver options="-showWeaveInfo -verbose"/> +<aspects> +<aspect name="X"/> +</aspects> +</aspectj> + diff --git a/tests/ltw/callMunging/case2/readme.txt b/tests/ltw/callMunging/case2/readme.txt new file mode 100644 index 000000000..5af1c9aaa --- /dev/null +++ b/tests/ltw/callMunging/case2/readme.txt @@ -0,0 +1 @@ +Now type T needs munging with a declare annotation
\ No newline at end of file diff --git a/tests/ltw/callMunging/case3/A.java b/tests/ltw/callMunging/case3/A.java new file mode 100644 index 000000000..3c15ddb4c --- /dev/null +++ b/tests/ltw/callMunging/case3/A.java @@ -0,0 +1,7 @@ +public class A { + S s = new S(); + public void method() { + System.out.println("A.method() running"); + s.m1(); + } +} diff --git a/tests/ltw/callMunging/case3/Main.java b/tests/ltw/callMunging/case3/Main.java new file mode 100644 index 000000000..8466ce953 --- /dev/null +++ b/tests/ltw/callMunging/case3/Main.java @@ -0,0 +1,17 @@ +import java.lang.reflect.Method; + +public class Main { + + public static void main(String []argv) { + try { + System.out.println("into:main"); + Class clazzA = Class.forName("A"); + Method clazzAMethod = clazzA.getMethod("method",null); + clazzAMethod.invoke(clazzA.newInstance(),null); + System.out.println("leave:main"); + } catch (Throwable t) { + t.printStackTrace(); + } + } + +} diff --git a/tests/ltw/callMunging/case3/S.java b/tests/ltw/callMunging/case3/S.java new file mode 100644 index 000000000..55cd6c5c2 --- /dev/null +++ b/tests/ltw/callMunging/case3/S.java @@ -0,0 +1,2 @@ +public class S extends T { +} diff --git a/tests/ltw/callMunging/case3/T.java b/tests/ltw/callMunging/case3/T.java new file mode 100644 index 000000000..9e177ba89 --- /dev/null +++ b/tests/ltw/callMunging/case3/T.java @@ -0,0 +1,3 @@ +public class T { + public void m1() {System.out.println("T.m1() running");} +} diff --git a/tests/ltw/callMunging/case3/X.java b/tests/ltw/callMunging/case3/X.java new file mode 100644 index 000000000..836aa7bbf --- /dev/null +++ b/tests/ltw/callMunging/case3/X.java @@ -0,0 +1,9 @@ +import java.io.Serializable; + +public aspect X { + declare parents: T implements Serializable; + + before(): call(* Serializable+.m*(..)) { + System.out.println("advice running"); + } +} diff --git a/tests/ltw/callMunging/case3/aop.xml b/tests/ltw/callMunging/case3/aop.xml new file mode 100644 index 000000000..321117898 --- /dev/null +++ b/tests/ltw/callMunging/case3/aop.xml @@ -0,0 +1,7 @@ +<aspectj> +<weaver options="-showWeaveInfo -verbose"/> +<aspects> +<aspect name="X"/> +</aspects> +</aspectj> + diff --git a/tests/ltw/callMunging/case3/readme.txt b/tests/ltw/callMunging/case3/readme.txt new file mode 100644 index 000000000..b23a4e28b --- /dev/null +++ b/tests/ltw/callMunging/case3/readme.txt @@ -0,0 +1 @@ +declare parents, but this time there is an extra layer in the hierarchy, A calls S but S extends T and T is decp targeted
\ No newline at end of file |