summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/binding/AtArgs3.aj
blob: dcd102233b1de612b45bc5fda0295f2e192a1140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME) @interface Colored   { String color(); }
@Retention(RetentionPolicy.RUNTIME) @interface Fruit     { String value(); }

@Colored(color="yellow") @Fruit("banana") class YB {}

public class AtArgs3 {
  public static void main(String[]argv) {
    m(new YB());
    if (!X.b)
      throw new Error("Advice should have run");
  }

  public static void m(Object a) {}

}

aspect X {

  static boolean b = false;

  before(): call(* m(..)) && !within(X) && @args(Colored) {
    b=true;
  }

}