From 14714d87d8e6822bb980c6fe6e3f5ef0a26537f7 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 4 Jun 2008 17:21:14 +0000 Subject: [PATCH] 235597: test and fix: annotations on generic methods --- tests/bugs161/pr235597/AnnotationTest1.java | 35 +++++++++++++++++++ tests/bugs161/pr235597/SomeAnnotation.java | 10 ++++++ tests/bugs161/pr235597/SomeAspect.java | 29 +++++++++++++++ .../systemtest/ajc161/Ajc161Tests.java | 4 +-- .../org/aspectj/systemtest/ajc161/ajc161.xml | 23 ++++++++++++ 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 tests/bugs161/pr235597/AnnotationTest1.java create mode 100644 tests/bugs161/pr235597/SomeAnnotation.java create mode 100644 tests/bugs161/pr235597/SomeAspect.java diff --git a/tests/bugs161/pr235597/AnnotationTest1.java b/tests/bugs161/pr235597/AnnotationTest1.java new file mode 100644 index 000000000..5106fe1ed --- /dev/null +++ b/tests/bugs161/pr235597/AnnotationTest1.java @@ -0,0 +1,35 @@ +public class AnnotationTest1 { + + @SomeAnnotation + public void test() { + System.out.println("test 1"); + } + + public static void main(String[] args) { + //CASE 1 + AnnotationTest1 test1 = new AnnotationTest1(); + test1.test(); + //CASE 2 + AnnotationTest2 test2 = new AnnotationTest2(); + test2.test2(); + //CASE 3 + AnnotationTest3 test3 = new AnnotationTest3(); + test3.test3(); + } + + public static class AnnotationTest2 { + + @SomeAnnotation + public void test2() { + System.out.println("test 2"); + } + } + + public static class AnnotationTest3 extends AnnotationTest2 { + + @SomeAnnotation + public void test3() { + System.out.println("test 3"); + } + } +} diff --git a/tests/bugs161/pr235597/SomeAnnotation.java b/tests/bugs161/pr235597/SomeAnnotation.java new file mode 100644 index 000000000..3ac1453b1 --- /dev/null +++ b/tests/bugs161/pr235597/SomeAnnotation.java @@ -0,0 +1,10 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface SomeAnnotation { + +} diff --git a/tests/bugs161/pr235597/SomeAspect.java b/tests/bugs161/pr235597/SomeAspect.java new file mode 100644 index 000000000..072e133e2 --- /dev/null +++ b/tests/bugs161/pr235597/SomeAspect.java @@ -0,0 +1,29 @@ +public aspect SomeAspect { + + void around(final SomeAnnotation someAnnotation) : + call(@SomeAnnotation void *.*(..)) && @annotation(someAnnotation) { + + System.out.println("@someAspect annotation parameter (call)"); +//CASES 1, 3 only + proceed(someAnnotation); + } + + void around(final SomeAnnotation someAnnotation) : + execution(@SomeAnnotation void *.*(..)) && +@annotation(someAnnotation) { + + System.out.println("@someAspect annotation parameter (execution)"); //CASES 1, 2, 3 + proceed(someAnnotation); + } + + void around() : call(@SomeAnnotation void *.*(..)) { + System.out.println("@someAspect annotation no parameter"); +//CASES 1, 2, 3 + proceed(); + } + + void around() : call(void *.test*(..)) { + System.out.println("@someAspect method name"); //CASES 1, 2, 3 + proceed(); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java index d03eebb5b..7aebc4b7b 100644 --- a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java @@ -23,6 +23,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // AspectJ1.6.1 + public void testAnnotationExposureGenerics_pr235597() { runTest("annotation exposure and generics");} public void testIncorrectRelationship_pr235204() { runTest("incorrect call relationship"); IRelationshipMap irm = AsmManager.getDefault().getRelationshipMap(); @@ -39,8 +40,7 @@ public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase { } } - public void testITDPrecedence_pr233838_1() { - runTest("itd precedence - 1"); } + public void testITDPrecedence_pr233838_1() { runTest("itd precedence - 1"); } public void testITDPrecedence_pr233838_2() { runTest("itd precedence - 2"); } public void testGetFieldGenerics_pr227401() { runTest("getfield problem with generics");} public void testGenericAbstractAspects_pr231478() { runTest("generic abstract aspects"); } diff --git a/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml b/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml index 8a48e58c5..7c87c3f24 100644 --- a/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml +++ b/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml @@ -3,6 +3,29 @@ + + + + + + + + + + + + + + + + + + + + + + + -- 2.39.5