You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AndTypePattern.java 541B

1234567891011121314151617181920212223242526
  1. import java.lang.annotation.Target;
  2. import java.lang.annotation.ElementType;
  3. @Target({ElementType.METHOD})
  4. @interface MethodAnnotation{}
  5. @Target({ElementType.FIELD})
  6. @interface FieldAnnotation{}
  7. public class AndTypePattern {
  8. public void method1() {}
  9. @FieldAnnotation
  10. int field = 1;
  11. }
  12. aspect A {
  13. // should display an xlint message because @FieldAnnotation can't be
  14. // applied to methods
  15. pointcut andPointcut() : execution(@(FieldAnnotation && MethodAnnotation) * *(..));
  16. declare warning : andPointcut() : "andPointcut()";
  17. }