blob: cbca12a22d871618849314cf4fdccb7d4fc0f083 (
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{}
@Target({ElementType.FIELD})
@interface FieldAnnotation{}
public class OrTypePattern {
public void method1() {}
@FieldAnnotation
int field = 1;
}
aspect A {
// should display an xlint message because @FieldAnnotation can't be
// applied to methods
pointcut orPointcut() : execution(@(FieldAnnotation || MethodAnnotation) * *(..));
declare warning : orPointcut() : "orPointcut()";
// two xlint messages should be displayed because neither @FieldAnnotation
// or @TypeAnnotation can match methods
pointcut orPointcut2() : execution(@(FieldAnnotation || TypeAnnotation) * *(..));
declare warning : orPointcut2() : "orPointcut2()";
}
|