diff options
author | aclement <aclement> | 2006-05-17 09:43:15 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-17 09:43:15 +0000 |
commit | 4842f1826c3905c2789bc99a2dc841c733092339 (patch) | |
tree | e6ddf2c302b220133f961a76a21203117bdc0361 /tests/bugs152 | |
parent | 40c0d949493e14806799cb4975135998b707c9f2 (diff) | |
download | aspectj-4842f1826c3905c2789bc99a2dc841c733092339.tar.gz aspectj-4842f1826c3905c2789bc99a2dc841c733092339.zip |
testcode for 135865 and 142165
Diffstat (limited to 'tests/bugs152')
-rw-r--r-- | tests/bugs152/pr135865/A.java | 30 | ||||
-rw-r--r-- | tests/bugs152/pr135865/B.java | 6 | ||||
-rw-r--r-- | tests/bugs152/pr135865/One.java | 51 | ||||
-rw-r--r-- | tests/bugs152/pr142165/A.java | 6 | ||||
-rw-r--r-- | tests/bugs152/pr142165/C.java | 8 | ||||
-rw-r--r-- | tests/bugs152/pr142165/aop.xml | 11 | ||||
-rw-r--r-- | tests/bugs152/pr142165/aop2.xml | 11 | ||||
-rw-r--r-- | tests/bugs152/pr142165/aop3.xml | 11 |
8 files changed, 134 insertions, 0 deletions
diff --git a/tests/bugs152/pr135865/A.java b/tests/bugs152/pr135865/A.java new file mode 100644 index 000000000..940540c26 --- /dev/null +++ b/tests/bugs152/pr135865/A.java @@ -0,0 +1,30 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) @interface Ann {} + + +aspect Aspect { + + // Call to an annotated method + pointcut annotated(Ann b) : call(@Ann * *(..)) && @annotation(b); + + // Top level call to an annotated method + pointcut annotatedTop(Ann b) : annotated(b) && !cflowbelow(annotated(Ann)); + + // Non top level call + pointcut annotatedNotTop(Ann b, Ann bTopo) : + annotated(b) && cflowbelow(annotatedTop(bTopo)); + + before(Ann b, Ann bTopo) : annotatedNotTop(b, bTopo) { + System.out.println("\tJoin point: " + thisJoinPointStaticPart); + } + + // Methods with out the Ann annotation but in an Ann annotated type get Ann + declare @method: !@Ann * (@Ann *).*(..) : @Ann; +} + +public class A { + @Ann void foo() { new B().foo(); new B().goo();} + public static void main(String[] args) { new A().foo(); } +} + diff --git a/tests/bugs152/pr135865/B.java b/tests/bugs152/pr135865/B.java new file mode 100644 index 000000000..c12542dd6 --- /dev/null +++ b/tests/bugs152/pr135865/B.java @@ -0,0 +1,6 @@ + +@Ann class B { + //@Ann + void foo() { } + void goo() { } +}
\ No newline at end of file diff --git a/tests/bugs152/pr135865/One.java b/tests/bugs152/pr135865/One.java new file mode 100644 index 000000000..f4110aa3b --- /dev/null +++ b/tests/bugs152/pr135865/One.java @@ -0,0 +1,51 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) @interface Ann {String value();} + +aspect Aspect { + + // Methods with out the Ann annotation but in an Ann annotated type get Ann +// declare @method: !@Ann * (@Ann *).*(..) : @Ann("introduced"); + + // Call to an annotated method + pointcut annotated(Ann b) : call(@Ann * *(..)) && @annotation(b); + + // Top level call to an annotated method + pointcut annotatedTop(Ann b) : annotated(b) && !cflowbelow(annotated(Ann)); + + // Non top level call + pointcut annotatedNotTop(Ann b, Ann bTopo) : + annotated(b) && cflowbelow(annotatedTop(bTopo)); + + before(Ann b, Ann bTopo) : + annotatedNotTop(b, bTopo) { + System.out.println("Non-top:"); + System.out.println("\tJoin point: " + thisJoinPointStaticPart); + System.out.println("\tEnclosing join point: " + thisEnclosingJoinPointStaticPart); + System.out.println("\tAnn: " + b); + System.out.println("\tTop annotation: " + bTopo); + } + +// before(Ann b) : +// annotatedTop(b) { +// System.out.println("Top:"); +// System.out.println("\tJoin point: " + thisJoinPointStaticPart); +// System.out.println("\tEnclosing join point: " + +//thisEnclosingJoinPointStaticPart); +// System.out.println("\tAnn: " + b); +// } +// declare @method: !@Ann * (@Ann *).*(..) : @Ann("introduced"); + declare @method: * B.goo() : @Ann("introduced"); +} + +public class A { + @Ann("A.foo") void foo() { new B().foo(); new B().goo();} + public static void main(String[] args) { new A().foo(); } +} + +@Ann("B") class B { + // The Ann is injected here! + @Ann("B.foo") + void foo() { } + void goo() { } +} diff --git a/tests/bugs152/pr142165/A.java b/tests/bugs152/pr142165/A.java new file mode 100644 index 000000000..a37879a7d --- /dev/null +++ b/tests/bugs152/pr142165/A.java @@ -0,0 +1,6 @@ +abstract aspect A { + abstract pointcut p(); + before(): p() { + System.err.println("advice"); + } +} diff --git a/tests/bugs152/pr142165/C.java b/tests/bugs152/pr142165/C.java new file mode 100644 index 000000000..e03fbc811 --- /dev/null +++ b/tests/bugs152/pr142165/C.java @@ -0,0 +1,8 @@ +public class C { + public static void main(String []argv) { + new C().foo(); + } + public void foo() {System.err.println("foo running");} +} + + diff --git a/tests/bugs152/pr142165/aop.xml b/tests/bugs152/pr142165/aop.xml new file mode 100644 index 000000000..5e89ba9d1 --- /dev/null +++ b/tests/bugs152/pr142165/aop.xml @@ -0,0 +1,11 @@ +<aspectj> + <weaver options="-Xnoinline"/> + <aspects> + <concrete-aspect name="AA" + extends="A"> + + <pointcut name="p" expression="within(SomeType) AND execution(* foo(..))" /> + + </concrete-aspect> + </aspects> +</aspectj> diff --git a/tests/bugs152/pr142165/aop2.xml b/tests/bugs152/pr142165/aop2.xml new file mode 100644 index 000000000..3fca4ec56 --- /dev/null +++ b/tests/bugs152/pr142165/aop2.xml @@ -0,0 +1,11 @@ +<aspectj> + <weaver options="-Xnoinline"/> + <aspects> + <concrete-aspect name="AA" + extends="A"> + + <pointcut name="p" expression="(within(*) AND (call(java.lang.String*.new(..)) || call(java.lang.Object.new(..))) )"/> + + </concrete-aspect> + </aspects> +</aspectj> diff --git a/tests/bugs152/pr142165/aop3.xml b/tests/bugs152/pr142165/aop3.xml new file mode 100644 index 000000000..d7ebd0732 --- /dev/null +++ b/tests/bugs152/pr142165/aop3.xml @@ -0,0 +1,11 @@ +<aspectj> + <weaver options="-Xnoinline"/> + <aspects> + <concrete-aspect name="AA" + extends="A"> + + <pointcut name="p" expression="within(C) AND call(* foo(..))" /> + + </concrete-aspect> + </aspects> +</aspectj> |