aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs152/pr138286/A.aj
blob: 2c20ea79ffe9a30065d6de64802d4a024c50d324 (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
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.*;

@Retention(RUNTIME)
@Inherited
@interface MyAnnotation {}

public aspect A perthis(annotatedClasses()) {
	
	pointcut annotatedClasses() : @this(MyAnnotation);
	
	before(): initialization(*.new(..)) {System.err.println(thisJoinPoint.getSignature().getDeclaringType()); }
	
	public static void main(String []argv) {
	  new Foo();
	  new Goo();
	  new Boo();
	  new Soo();
	}
}

// yes/no indicates if runtime match expected for staticinitialization

@MyAnnotation class Foo { } // YES

class Goo { }               // NO

@MyAnnotation class Boo { } // YES

class Soo extends Boo { }   // YES