Community
Participate
Working Groups
Take this little Test case: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface TestAnnotation1 {} @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface TestAnnotation2{} @TestAnnotation1 public class Annotated {} public interface Marker {} public aspect AnnotationAspect { declare @type: @TestAnnotation1 *: @TestAnnotation2; // of cource this matches // declare parents: (@TestAnnotation1 *) implements Marker; // this matches, too // declare parents: (@TestAnnotation2 *) implements Marker; // this does not match on Annotated declare parents: (@TestAnnotation2 *) && !java.lang.annotation.Annotation implements Marker; // but this does match on annotated // declare parents: (@TestAnnotation1 *) && !java.lang.annotation.Annotation implements Marker; }
fixed - the implementation of And for type patterns did not defer to its left and right branches when checking whether it represented a '*' annotation pattern. might still be an issue for ! type patterns involving annotations, but I'll look at that some other time ;)