diff options
-rw-r--r-- | tests/bugs153/pr158126/A.java | 17 | ||||
-rw-r--r-- | tests/bugs153/pr158126/B.java | 12 | ||||
-rw-r--r-- | tests/bugs153/pr158126/MyAnnotation.java | 7 | ||||
-rw-r--r-- | tests/bugs153/pr158126/MyAspect.java | 7 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/ajc153.xml | 9 |
6 files changed, 53 insertions, 0 deletions
diff --git a/tests/bugs153/pr158126/A.java b/tests/bugs153/pr158126/A.java new file mode 100644 index 000000000..d92c77fcb --- /dev/null +++ b/tests/bugs153/pr158126/A.java @@ -0,0 +1,17 @@ +public class A { + + @MyAnnotation + public A() { + new B(); + } + + @MyAnnotation + public A(int i) { + new B(i); + } + + public static void main(String[] args) { + new A(); + new A(1); + } +} diff --git a/tests/bugs153/pr158126/B.java b/tests/bugs153/pr158126/B.java new file mode 100644 index 000000000..bdbfa788d --- /dev/null +++ b/tests/bugs153/pr158126/B.java @@ -0,0 +1,12 @@ +public class B { + + @MyAnnotation + public B() { + + } + + @MyAnnotation + public B(int i) { + + } +} diff --git a/tests/bugs153/pr158126/MyAnnotation.java b/tests/bugs153/pr158126/MyAnnotation.java new file mode 100644 index 000000000..33d13ead8 --- /dev/null +++ b/tests/bugs153/pr158126/MyAnnotation.java @@ -0,0 +1,7 @@ +import java.lang.annotation.*; + +@Target(ElementType.CONSTRUCTOR) +@Retention(RetentionPolicy.RUNTIME) +public @interface MyAnnotation { + +} diff --git a/tests/bugs153/pr158126/MyAspect.java b/tests/bugs153/pr158126/MyAspect.java new file mode 100644 index 000000000..0ab4a323e --- /dev/null +++ b/tests/bugs153/pr158126/MyAspect.java @@ -0,0 +1,7 @@ +public aspect MyAspect { + + before() : + call(@MyAnnotation *.new(..)) { + System.out.println(thisJoinPoint); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index 4c8fdd0cd..7e6c95f56 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -28,6 +28,7 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} // public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); } + public void testAnnotationsCallConstructors_pr158126() { runTest("annotations, call and constructors problem");} public void testIllegalStateExceptionGenerics_pr153845() { runTest("IllegalStateException at GenericSignatureParser.java"); } public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_1() { runTest("no illegal state exception from AsmDelegate - 1");} public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_2() { runTest("no illegal state exception from AsmDelegate - 2");} diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 2beddab01..665c73c0f 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -8,6 +8,15 @@ <compile files="Nothing.java" aspectpath="blob.jar" options="-1.5" outjar="bang.jar"/> </ajc-test> + <ajc-test dir="bugs153/pr158126" title="annotations, call and constructors problem"> + <compile files="A.java,B.java,MyAnnotation.java,MyAspect.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-call(void B.<init>())' in Type 'A' (A.java:5) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + <message kind="weave" text="Join point 'constructor-call(void B.<init>(int))' in Type 'A' (A.java:10) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + <message kind="weave" text="Join point 'constructor-call(void A.<init>())' in Type 'A' (A.java:14) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + <message kind="weave" text="Join point 'constructor-call(void A.<init>(int))' in Type 'A' (A.java:15) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + </compile> + </ajc-test> + <ajc-test dir="bugs153/pr156058" title="no IllegalStateException with generic inner aspect"> <compile files="Bug.java" options="-1.5"> <message kind="warning" line="2" text="advice defined in MyAspect has not been applied [Xlint:adviceDidNotMatch]"/> |