--- /dev/null
+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);
+ }
+}
--- /dev/null
+public class B {
+
+ @MyAnnotation
+ public B() {
+
+ }
+
+ @MyAnnotation
+ public B(int i) {
+
+ }
+}
--- /dev/null
+import java.lang.annotation.*;
+
+@Target(ElementType.CONSTRUCTOR)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MyAnnotation {
+
+}
--- /dev/null
+public aspect MyAspect {
+
+ before() :
+ call(@MyAnnotation *.new(..)) {
+ System.out.println(thisJoinPoint);
+ }
+}
// 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");}
<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]"/>