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