From e9e52fea126c8177bf8fead1353ffc31e208440b Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 8 Jan 2007 15:45:41 +0000 Subject: [PATCH] test and fix for 169706: inherited annotations down a hierarchy greater than 2 deep --- tests/bugs160/pr169706/A.java | 8 ++++++++ tests/bugs160/pr169706/B.java | 3 +++ tests/bugs160/pr169706/C.java | 3 +++ tests/bugs160/pr169706/MyAnnotation.java | 3 +++ tests/bugs160/pr169706/MyAspect.java | 16 ++++++++++++++++ tests/bugs160/pr169706/Test.java | 8 ++++++++ .../aspectj/systemtest/ajc160/Ajc160Tests.java | 1 + .../src/org/aspectj/systemtest/ajc160/ajc160.xml | 6 ++++++ 8 files changed, 48 insertions(+) create mode 100644 tests/bugs160/pr169706/A.java create mode 100644 tests/bugs160/pr169706/B.java create mode 100644 tests/bugs160/pr169706/C.java create mode 100644 tests/bugs160/pr169706/MyAnnotation.java create mode 100644 tests/bugs160/pr169706/MyAspect.java create mode 100644 tests/bugs160/pr169706/Test.java diff --git a/tests/bugs160/pr169706/A.java b/tests/bugs160/pr169706/A.java new file mode 100644 index 000000000..a40ef7bcf --- /dev/null +++ b/tests/bugs160/pr169706/A.java @@ -0,0 +1,8 @@ +public class A { + + @MyAnnotation + public void foo() { + + } + +} diff --git a/tests/bugs160/pr169706/B.java b/tests/bugs160/pr169706/B.java new file mode 100644 index 000000000..120fb1868 --- /dev/null +++ b/tests/bugs160/pr169706/B.java @@ -0,0 +1,3 @@ +public class B extends A { + +} diff --git a/tests/bugs160/pr169706/C.java b/tests/bugs160/pr169706/C.java new file mode 100644 index 000000000..8acb6675c --- /dev/null +++ b/tests/bugs160/pr169706/C.java @@ -0,0 +1,3 @@ +public class C extends B { + +} diff --git a/tests/bugs160/pr169706/MyAnnotation.java b/tests/bugs160/pr169706/MyAnnotation.java new file mode 100644 index 000000000..723084377 --- /dev/null +++ b/tests/bugs160/pr169706/MyAnnotation.java @@ -0,0 +1,3 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation {} diff --git a/tests/bugs160/pr169706/MyAspect.java b/tests/bugs160/pr169706/MyAspect.java new file mode 100644 index 000000000..e533064db --- /dev/null +++ b/tests/bugs160/pr169706/MyAspect.java @@ -0,0 +1,16 @@ +public aspect MyAspect { + + // this throws an exception + before(MyAnnotation myAnnotation) : + //call(* *..*.*(..)) && + call(@MyAnnotation * *(..)) && + @annotation(myAnnotation) { + + } + + // this, however, works fine +// before() : + // call(@MyAnnotation * *(..)) { + // + // } +} diff --git a/tests/bugs160/pr169706/Test.java b/tests/bugs160/pr169706/Test.java new file mode 100644 index 000000000..b8af6a677 --- /dev/null +++ b/tests/bugs160/pr169706/Test.java @@ -0,0 +1,8 @@ +public class Test { + + public static void main(String args[]) { + C c = new C(); + c.foo(); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java index f819e3349..adc134330 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java @@ -21,6 +21,7 @@ import junit.framework.Test; */ public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testInheritedAnnotations_pr169706() { runTest("inherited annotations");} public void testGenericFieldNPE_pr165885() { runTest("generic field npe");} public void testIncorrectOptimizationOfIstore_pr166084() { runTest("incorrect optimization of istore"); } public void testDualParameterizationsNotAllowed_pr165631() { runTest("dual parameterizations not allowed"); } diff --git a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml index d0c440e41..a83215452 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml +++ b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml @@ -4,6 +4,12 @@ + + + + + + -- 2.39.5