org.aspectj/tests/bugs152/pr138286/A.aj

31 lines
682 B
Plaintext
Raw Normal View History

2006-04-26 18:45:17 +02:00
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