aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features1611/declareMinus/OnOff2.java
blob: c9c888bbf085f91394018ab67d465a66dd2092d1 (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
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@interface Anno {}

aspect Foo {
  declare @field: @Anno * OnOff2.*: -@Anno;
  declare @field: * OnOff2.*: @Anno;
}

public class OnOff2 {

  public static int field;

  public int field2;

  public static void main(String[]argv) throws Exception {
    Object o = OnOff2.class.getDeclaredField("field").getAnnotation(Anno.class);
    System.out.println("field annotated? "+(o==null?"no":"yes"));

    o = OnOff2.class.getDeclaredField("field2").getAnnotation(Anno.class);
    System.out.println("field2 annotated? "+(o==null?"no":"yes"));
  }
}