aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features161/optimizedAnnotationBinding/CaseEleven.java
blob: d8f86d80d952a430699932bfbbf998b819f40dd7 (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
29
30
31
32
33
34
35
// CaseEleven - binding multiple annotation fields
import java.lang.annotation.*;

public class CaseEleven {

  public static void main(String []argv) {
   
    CaseEleven o = new CaseEleven();
    o.a();
    o.b();
    o.c();
    o.d();
    o.e();
  }

                     public void a() {}
  @Anno(value=Level.NONE,c=Color.RED)  public void b() {}
  @Anno(value=Level.ONE)   public void c() {}
  @Anno(value=Level.TWO,c=Color.GREEN)   public void d() {}
  @Anno(value=Level.THREE,c=Color.BLUE) public void e() {}

}

enum Level { NONE, ONE, TWO, THREE; }
enum Color { RED, GREEN, BLUE; }

@Retention(RetentionPolicy.RUNTIME)
@interface Anno { Level value(); Color c() default Color.GREEN; }

aspect X {

  before(Level l,Color color): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) && @annotation(Anno(color)) {
    System.out.println(l+":"+color);
  }
}