blob: cba868929316844ebae27a3cdc143c2f71515b2f (
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
|
import java.lang.annotation.*;
interface Behavior {
String hello();
}
aspect Trait {
@Wibble
public String Behavior.hello() throws java.io.IOException {
return "hello";
}
}
public class Target3 implements Behavior {
public static aspect A {
declare @method: * Target3.hello(..): @Tagged;
}
public static void main(String []argv) throws Exception {
System.out.println(Target3.class.getDeclaredMethod("hello").getDeclaredAnnotations().length);
System.out.println(Target3.class.getDeclaredMethod("hello").getDeclaredAnnotations()[0]);
System.out.println(Target3.class.getDeclaredMethod("hello").getDeclaredAnnotations()[1]);
}
}
@Retention(RetentionPolicy.RUNTIME) @interface Tagged {}
@Retention(RetentionPolicy.RUNTIME) @interface Wibble {}
|