blob: 2b8d416d2ef1fdd8dbe407b5caf0ffa6cdc95c5d (
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
|
// CaseOne - new syntax
import java.lang.annotation.*;
public class CaseOne {
public static void main(String []argv) {
CaseOne o = new CaseOne();
o.a();
o.b();
o.c();
o.d();
o.e();
}
public void a() {}
@Anno(Level.NONE) public void b() {}
@Anno(Level.ONE) public void c() {}
@Anno(Level.TWO) public void d() {}
@Anno(Level.THREE) public void e() {}
}
enum Level { NONE, ONE, TWO, THREE; }
@Retention(RetentionPolicy.RUNTIME)
@interface Anno { Level value();}
aspect X {
before(Level l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) {
System.out.println(l);
}
}
|