Community
Participate
Working Groups
The following aspect won't compile with aspect 1.5: package aj; import java.lang.annotation.Annotation; public abstract aspect GenericAnnotation<A extends Annotation> { pointcut annotatedCall(A a) : call(@A * *.*(..)) && @annotation(a); /* does not compile */ before(A a) : annotatedCall(a) { System.out.println(a.annotationType()); } /* */ /* OK */ before(A a) : call(@A * *.*(..)) && @annotation(a) { System.out.println(a.annotationType()); } } ---------------------- >ajc -1.5 -d aj src\aj\* ...\src\aj\GenericAnnotation.aj:10 [error] incompatible type, expected java.lang.annotation.Annotation found BindingTypePattern(TA;, 0). Check the type specified in your pointcut before(A a) : annotatedCall(a) { 1 error ---------------- Commenting out the first advice lets this program run as expected: package aj; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; public class Main { @Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation { } static aspect ConcreteAnnotation extends GenericAnnotation<MyAnnotation> { } public static void main(String[] args) { someMethod(); } @MyAnnotation private static void someMethod() { } }
appears the code putting out the message isnt being smart about encountering type variables...
fix checked in.
fix available.