Community
Participate
Working Groups
Hello all, I have found something that I believe it is a bug related to annotations on constructors. The code is the following: 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); } } public class B { @MyAnnotation public B() { } @MyAnnotation public B(int i) { } } @Target(ElementType.CONSTRUCTOR) @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotation { } public aspect MyAspect { before() : call(@MyAnnotation *.new(..)) { System.out.println(thisJoinPoint); } } The result: call(pt.iscte.ci.test.A()) call(pt.iscte.ci.test.A(int)) Why aren't the calls to B() and B(int) matched and shown in the output? If I change the pointcut to call(*.new(..)), the output is the expected: call(pt.iscte.ci.test.A()) call(pt.iscte.ci.test.B()) call(pt.iscte.ci.test.A(int)) call(pt.iscte.ci.test.B(int)) This is a bug, right? Best regards, Paulo Zenida
Passing over to compiler
As soon as I added this test code to the compiler, I realised it would have been impacted by a fix I made last week. So this code already works with the latest AspectJ dev build - and an AJDT build including it will be released shortly. I've added the test case anyway, as it is a nice one to have.
The latest 1.4 and 1.5 AJDT dev builds now contain this fix.