blob: 89df1d8206b4b19b2cec2b27b0cb1c4e771bcd13 (
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
|
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
@Target({ElementType.TYPE})
@interface TypeAnnotation{}
@Target({ElementType.METHOD})
@interface MethodAnnotation{}
public class AnnotationParameterType {
public void method1(MyClass m) {
}
}
@TypeAnnotation
class MyClass {
}
aspect A {
// shouldn't get an xlint warning because looking method which
// takes an argument that has the @TypeAnnotation
pointcut pc() : execution(* *(@TypeAnnotation *));
declare warning : pc() : "* *(@TypeAnnotation *)";
// should get an xlint warning because can only have the default,
// or @Target{ElementType.TYPE} as an argument type
pointcut incorrectArgumentType() : execution(* *(@MethodAnnotation *));
declare warning : incorrectArgumentType() : "argument type can only have @Target{ElementType.TYPE}";
}
|