summaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/ajdkExamples/AnnotationInheritance.aj
blob: 1a437183bf7f9099df3680c5c1bf9e18996a6bba (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
	import java.lang.annotation.*;
	
	class C1 {
	  @SomeAnnotation
	  public void aMethod() {}
	}
	
	class C2 extends C1 {
	  public void aMethod() {}
	}
	
	class Main {
	  public static void main(String[] args) {
	    C1 c1 = new C1();
	    C2 c2 = new C2();
	    c1.aMethod();
	    c2.aMethod();
	  }
	}
	
	aspect X {
	
	  pointcut annotatedC2MethodCall() : 
	    call(@SomeAnnotation * C2.aMethod());  // matches nothing
	
	  pointcut annotatedMethodCall() :   // CW L16
	    call(@SomeAnnotation * aMethod());
	  
	  declare warning : annotatedC2MethodCall() : "annotatedC2MethodCall()";
	  declare warning : annotatedMethodCall() : "annotatedMethodCall()";
	}
	
	@Inherited @interface SomeAnnotation {}