1
import java.lang.annotation.Target;
2
import java.lang.annotation.ElementType;
4
@Target({ElementType.TYPE})
5
@interface TypeAnnotation{}
7
@Target({ElementType.METHOD})
8
@interface MethodAnnotation{}
11
public class AnnotationDeclaringType {
13
public void method1() {
20
// matches the execution of any method where the declaring type
21
// has the @TypeAnnotation - should compile ok and get no xlint errors
22
pointcut pc() : execution(* (@TypeAnnotation *).*(..));
23
declare warning : pc() : "* (@TypeAnnotation *).*(..)";
25
// should get an xlint warning because declaring types can only
26
// have the default @Target or @Target{ElementType.TYPE} target
27
pointcut pc2() : execution(* (@MethodAnnotation *).*(..));
28
declare warning : pc2() : "* (@MethodAnnotation *).*(..)";