blob: bbd986f8a1fa24623a0d64e12d0c0b3f08f622a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
//"must have runtime retention"
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@interface MyRuntimeAnnotation {}
@Retention(RetentionPolicy.SOURCE)
@interface MySourceAnnotation {}
@Retention(RetentionPolicy.CLASS)
@interface MyClassAnnotation {}
@interface MyAnnotation {}
aspect X {
@MyRuntimeAnnotation @MySourceAnnotation @MyClassAnnotation @MyAnnotation
void a(){}
before(MyRuntimeAnnotation a): execution(* *(..)) && @annotation(a) {} // no error
before(MySourceAnnotation a): execution(* *(..)) && @annotation(a) {} // error expected
before(MyClassAnnotation a): execution(* *(..)) && @annotation(a) {} // error expected
before(MyAnnotation a): execution(* *(..)) && @annotation(a) {} // error expected
}
|