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.

CaseFour.java 591B

1234567891011121314151617181920212223242526272829
  1. // CaseFour - default value specified and should be extracted
  2. import java.lang.annotation.*;
  3. public class CaseFour {
  4. public static void main(String []argv) {
  5. CaseFour o = new CaseFour();
  6. o.a();
  7. o.b();
  8. o.c();
  9. }
  10. @Anno public void a() {}
  11. @Anno(Level.TWO) public void b() {}
  12. @Anno public void c() {}
  13. }
  14. enum Level { NONE, ONE, TWO, THREE; }
  15. @Retention(RetentionPolicy.RUNTIME)
  16. @interface Anno { Level value() default Level.ONE;}
  17. aspect X {
  18. before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) {
  19. System.out.println(l);
  20. }
  21. }