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.

GenericAspectWithAnnotationTypeParameter.aj 823B

1234567891011121314151617181920212223242526272829303132333435
  1. import java.lang.annotation.Annotation;
  2. import java.lang.annotation.Retention;
  3. import java.lang.annotation.RetentionPolicy;
  4. public class GenericAspectWithAnnotationTypeParameter {
  5. @AnnOne
  6. @AnnTwo
  7. public static void main(String[] args) {
  8. System.out.println("hello");
  9. }
  10. }
  11. @Retention(RetentionPolicy.RUNTIME)
  12. @interface AnnOne {}
  13. @interface AnnTwo {}
  14. abstract aspect AnnotationMatcher<A extends Annotation> {
  15. before() : execution(* *(..)) && @annotation(A) {
  16. System.out.println("annotation match - no binding");
  17. }
  18. before() : execution(@A * *(..)) {
  19. System.out.println("execution with annotation match");
  20. }
  21. before(A anAnnotation) : execution(* *(..)) && @annotation(anAnnotation) {
  22. System.out.println("annotation match - binding");
  23. }
  24. }
  25. aspect AnnOneMatcher extends AnnotationMatcher<AnnOne> {}