blob: 122a874d3f8de59cb79af2dd9fe6c4432e4ab66b (
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
|
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
@Target({ElementType.TYPE})
@interface TypeAnnotation{}
@Target({ElementType.METHOD})
@interface MethodAnnotation{}
@TypeAnnotation
public class AnnotationDeclaringType {
public void method1() {
}
}
aspect A {
// matches the execution of any method where the declaring type
// has the @TypeAnnotation - should compile ok and get no xlint errors
pointcut pc() : execution(* (@TypeAnnotation *).*(..));
declare warning : pc() : "* (@TypeAnnotation *).*(..)";
// should get an xlint warning because declaring types can only
// have the default @Target or @Target{ElementType.TYPE} target
pointcut pc2() : execution(* (@MethodAnnotation *).*(..));
declare warning : pc2() : "* (@MethodAnnotation *).*(..)";
}
|