aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-08-14 13:26:04 +0000
committeraclement <aclement>2006-08-14 13:26:04 +0000
commit0adc866c0f8b8eb0f9d398898c052a3376936b8d (patch)
tree246136fcc556f4f67cc1a92c11ca989cac9168c2
parent11fe8eb9db9ca99da426b3f58c51b4315af5a83b (diff)
downloadaspectj-0adc866c0f8b8eb0f9d398898c052a3376936b8d.tar.gz
aspectj-0adc866c0f8b8eb0f9d398898c052a3376936b8d.zip
testcode for call and decp LTW 133770
-rw-r--r--tests/ltw/callMunging/A.java7
-rw-r--r--tests/ltw/callMunging/B.java7
-rw-r--r--tests/ltw/callMunging/Main.java21
-rw-r--r--tests/ltw/callMunging/T.java6
-rw-r--r--tests/ltw/callMunging/X.java9
-rw-r--r--tests/ltw/callMunging/aop.xml7
-rw-r--r--tests/ltw/callMunging/case1/A.java7
-rw-r--r--tests/ltw/callMunging/case1/Main.java17
-rw-r--r--tests/ltw/callMunging/case1/T.java3
-rw-r--r--tests/ltw/callMunging/case1/X.java9
-rw-r--r--tests/ltw/callMunging/case1/aop.xml7
-rw-r--r--tests/ltw/callMunging/case1/readme.txt1
-rw-r--r--tests/ltw/callMunging/case2/A.java7
-rw-r--r--tests/ltw/callMunging/case2/Main.java17
-rw-r--r--tests/ltw/callMunging/case2/MarkerAnnotation.java3
-rw-r--r--tests/ltw/callMunging/case2/T.java3
-rw-r--r--tests/ltw/callMunging/case2/X.java9
-rw-r--r--tests/ltw/callMunging/case2/aop.xml7
-rw-r--r--tests/ltw/callMunging/case2/readme.txt1
-rw-r--r--tests/ltw/callMunging/case3/A.java7
-rw-r--r--tests/ltw/callMunging/case3/Main.java17
-rw-r--r--tests/ltw/callMunging/case3/S.java2
-rw-r--r--tests/ltw/callMunging/case3/T.java3
-rw-r--r--tests/ltw/callMunging/case3/X.java9
-rw-r--r--tests/ltw/callMunging/case3/aop.xml7
-rw-r--r--tests/ltw/callMunging/case3/readme.txt1
-rw-r--r--tests/ltw/hier/aop-single.xml7
-rw-r--r--tests/ltw/hier/child/Advisor.aj23
-rw-r--r--tests/ltw/hier/child/Executor.aj20
-rw-r--r--tests/ltw/hier/null-aop.xml2
-rw-r--r--tests/ltw/hier/top/SimpleMain.aj18
-rw-r--r--tests/ltw/hier/util/A.aj16
-rw-r--r--tests/ltw/hier/util/T.aj14
33 files changed, 294 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
diff --git a/tests/ltw/hier/aop-single.xml b/tests/ltw/hier/aop-single.xml
new file mode 100644
index 000000000..9546f8c60
--- /dev/null
+++ b/tests/ltw/hier/aop-single.xml
@@ -0,0 +1,7 @@
+<aspectj>
+ <weaver options="-showWeaveInfo"/>
+ <aspects>
+ <aspect name="child.Advisor"/>
+ </aspects>
+</aspectj>
+
diff --git a/tests/ltw/hier/child/Advisor.aj b/tests/ltw/hier/child/Advisor.aj
new file mode 100644
index 000000000..d7b6b33ac
--- /dev/null
+++ b/tests/ltw/hier/child/Advisor.aj
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ron Bodkin
+ */
+package child;
+
+import util.A;
+import util.T;
+
+aspect Advisor {
+ declare parents: A* implements T;
+
+ before() : call(* T+.*(..)) {
+ System.out.println("T call");
+ }
+}
diff --git a/tests/ltw/hier/child/Executor.aj b/tests/ltw/hier/child/Executor.aj
new file mode 100644
index 000000000..74a90a07a
--- /dev/null
+++ b/tests/ltw/hier/child/Executor.aj
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ron Bodkin
+ */
+package child;
+
+import util.A;
+
+public class Executor implements Runnable {
+ public void run() {
+ new A().foo();
+ }
+}
diff --git a/tests/ltw/hier/null-aop.xml b/tests/ltw/hier/null-aop.xml
new file mode 100644
index 000000000..6ca1f4ac0
--- /dev/null
+++ b/tests/ltw/hier/null-aop.xml
@@ -0,0 +1,2 @@
+<!-- empty aop.xml file. Used to turn on load-time weaving with no aspects defined at top-level -->
+<aspectj/>
diff --git a/tests/ltw/hier/top/SimpleMain.aj b/tests/ltw/hier/top/SimpleMain.aj
new file mode 100644
index 000000000..1355fb401
--- /dev/null
+++ b/tests/ltw/hier/top/SimpleMain.aj
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ron Bodkin
+ */
+package top;
+
+public class SimpleMain {
+ public static void main(String args[]) throws Exception {
+ new child.Executor().run();
+ }
+}
diff --git a/tests/ltw/hier/util/A.aj b/tests/ltw/hier/util/A.aj
new file mode 100644
index 000000000..df695c09d
--- /dev/null
+++ b/tests/ltw/hier/util/A.aj
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ron Bodkin
+ */
+package util;
+
+public class A {
+ public void foo() {}
+}
diff --git a/tests/ltw/hier/util/T.aj b/tests/ltw/hier/util/T.aj
new file mode 100644
index 000000000..f87f92d4a
--- /dev/null
+++ b/tests/ltw/hier/util/T.aj
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ron Bodkin
+ */
+package util;
+
+public interface T {}