From 0adc866c0f8b8eb0f9d398898c052a3376936b8d Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 14 Aug 2006 13:26:04 +0000 Subject: [PATCH] testcode for call and decp LTW 133770 --- tests/ltw/callMunging/A.java | 7 ++++++ tests/ltw/callMunging/B.java | 7 ++++++ tests/ltw/callMunging/Main.java | 21 +++++++++++++++++ tests/ltw/callMunging/T.java | 6 +++++ tests/ltw/callMunging/X.java | 9 ++++++++ tests/ltw/callMunging/aop.xml | 7 ++++++ tests/ltw/callMunging/case1/A.java | 7 ++++++ tests/ltw/callMunging/case1/Main.java | 17 ++++++++++++++ tests/ltw/callMunging/case1/T.java | 3 +++ tests/ltw/callMunging/case1/X.java | 9 ++++++++ tests/ltw/callMunging/case1/aop.xml | 7 ++++++ tests/ltw/callMunging/case1/readme.txt | 1 + tests/ltw/callMunging/case2/A.java | 7 ++++++ tests/ltw/callMunging/case2/Main.java | 17 ++++++++++++++ .../callMunging/case2/MarkerAnnotation.java | 3 +++ tests/ltw/callMunging/case2/T.java | 3 +++ tests/ltw/callMunging/case2/X.java | 9 ++++++++ tests/ltw/callMunging/case2/aop.xml | 7 ++++++ tests/ltw/callMunging/case2/readme.txt | 1 + tests/ltw/callMunging/case3/A.java | 7 ++++++ tests/ltw/callMunging/case3/Main.java | 17 ++++++++++++++ tests/ltw/callMunging/case3/S.java | 2 ++ tests/ltw/callMunging/case3/T.java | 3 +++ tests/ltw/callMunging/case3/X.java | 9 ++++++++ tests/ltw/callMunging/case3/aop.xml | 7 ++++++ tests/ltw/callMunging/case3/readme.txt | 1 + tests/ltw/hier/aop-single.xml | 7 ++++++ tests/ltw/hier/child/Advisor.aj | 23 +++++++++++++++++++ tests/ltw/hier/child/Executor.aj | 20 ++++++++++++++++ tests/ltw/hier/null-aop.xml | 2 ++ tests/ltw/hier/top/SimpleMain.aj | 18 +++++++++++++++ tests/ltw/hier/util/A.aj | 16 +++++++++++++ tests/ltw/hier/util/T.aj | 14 +++++++++++ 33 files changed, 294 insertions(+) create mode 100644 tests/ltw/callMunging/A.java create mode 100644 tests/ltw/callMunging/B.java create mode 100644 tests/ltw/callMunging/Main.java create mode 100644 tests/ltw/callMunging/T.java create mode 100644 tests/ltw/callMunging/X.java create mode 100644 tests/ltw/callMunging/aop.xml create mode 100644 tests/ltw/callMunging/case1/A.java create mode 100644 tests/ltw/callMunging/case1/Main.java create mode 100644 tests/ltw/callMunging/case1/T.java create mode 100644 tests/ltw/callMunging/case1/X.java create mode 100644 tests/ltw/callMunging/case1/aop.xml create mode 100644 tests/ltw/callMunging/case1/readme.txt create mode 100644 tests/ltw/callMunging/case2/A.java create mode 100644 tests/ltw/callMunging/case2/Main.java create mode 100644 tests/ltw/callMunging/case2/MarkerAnnotation.java create mode 100644 tests/ltw/callMunging/case2/T.java create mode 100644 tests/ltw/callMunging/case2/X.java create mode 100644 tests/ltw/callMunging/case2/aop.xml create mode 100644 tests/ltw/callMunging/case2/readme.txt create mode 100644 tests/ltw/callMunging/case3/A.java create mode 100644 tests/ltw/callMunging/case3/Main.java create mode 100644 tests/ltw/callMunging/case3/S.java create mode 100644 tests/ltw/callMunging/case3/T.java create mode 100644 tests/ltw/callMunging/case3/X.java create mode 100644 tests/ltw/callMunging/case3/aop.xml create mode 100644 tests/ltw/callMunging/case3/readme.txt create mode 100644 tests/ltw/hier/aop-single.xml create mode 100644 tests/ltw/hier/child/Advisor.aj create mode 100644 tests/ltw/hier/child/Executor.aj create mode 100644 tests/ltw/hier/null-aop.xml create mode 100644 tests/ltw/hier/top/SimpleMain.aj create mode 100644 tests/ltw/hier/util/A.aj create mode 100644 tests/ltw/hier/util/T.aj 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 @@ + + + + + + + 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 @@ + + + + + + + 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 @@ + + + + + + + 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 @@ + + + + + + + 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 @@ + + + + + + + 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 @@ + + 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 {} -- 2.39.5