blob: b4103f9e18d5620d445d6e0cecf0f786ab69ee69 (
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
|
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@interface TestAnnotation {
public boolean value() default true;
}
aspect TestAspect {
declare parents: Failing implements TestInterface;
// this also does not work (even when removing annotation in the following ITD)
// declare @method: public void TestInterface.foo(): @TestAnnotation;
@TestAnnotation
public void TestInterface.foo() {
System.err.println("foo");
}
}
interface TestInterface {
public void foo();
}
public class Failing {
public static void main(String[] args) throws Exception {
System.err.println("On TestInterface:"+TestInterface.class.getDeclaredMethod("foo").getAnnotation(TestAnnotation.class));
System.err.println("On Failing:"+Failing.class.getDeclaredMethod("foo").getAnnotation(TestAnnotation.class));
}
}
|