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.

AtArgs3.aj 581B

12345678910111213141516171819202122232425262728
  1. import java.lang.annotation.*;
  2. @Retention(RetentionPolicy.RUNTIME) @interface Colored { String color(); }
  3. @Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value(); }
  4. @Colored(color="yellow") @Fruit("banana") class YB {}
  5. public class AtArgs3 {
  6. public static void main(String[]argv) {
  7. m(new YB());
  8. if (!X.b)
  9. throw new Error("Advice should have run");
  10. }
  11. public static void m(Object a) {}
  12. }
  13. aspect X {
  14. static boolean b = false;
  15. before(): call(* m(..)) && !within(X) && @args(Colored) {
  16. b=true;
  17. }
  18. }