diff options
Diffstat (limited to 'tests/bugs174')
-rw-r--r-- | tests/bugs174/pr418129/Target.java | 27 | ||||
-rw-r--r-- | tests/bugs174/pr418129/Target2.java | 27 | ||||
-rw-r--r-- | tests/bugs174/pr418129/Target3.java | 27 | ||||
-rw-r--r-- | tests/bugs174/pr418129/Target4.java | 25 |
4 files changed, 106 insertions, 0 deletions
diff --git a/tests/bugs174/pr418129/Target.java b/tests/bugs174/pr418129/Target.java new file mode 100644 index 000000000..a3d1b2e97 --- /dev/null +++ b/tests/bugs174/pr418129/Target.java @@ -0,0 +1,27 @@ +import java.lang.annotation.*; + +interface Behavior { +String hello(); +} + +aspect Trait { + // public String Behavior.name; + + public String Behavior.hello() { + return "hello"; + } +} + +public class Target implements Behavior { + public static aspect A { +// declare @field: * Target.name: @Tagged; // NO WORKY + declare @method: * Target.hello(..): @Tagged; // NO WORKY + } + + public static void main(String []argv) throws Exception { + System.out.println(Target.class.getDeclaredMethod("hello").getDeclaredAnnotations()[0]); + } +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Tagged {} diff --git a/tests/bugs174/pr418129/Target2.java b/tests/bugs174/pr418129/Target2.java new file mode 100644 index 000000000..cc8b9e839 --- /dev/null +++ b/tests/bugs174/pr418129/Target2.java @@ -0,0 +1,27 @@ +import java.lang.annotation.*; + +interface Behavior { + String hello(); +} + +aspect Trait { +// public String Behavior.name; + + public String Behavior.hello() throws java.io.IOException { + return "hello"; + } +} + +public class Target2 implements Behavior { + public static aspect A { +// declare @field: * Target2.name: @Tagged; // NO WORKY + declare @method: * Target2.hello(..): @Tagged; // NO WORKY + } + + public static void main(String []argv) throws Exception { + System.out.println(Target2.class.getDeclaredMethod("hello").getDeclaredAnnotations()[0]); + } +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Tagged {} diff --git a/tests/bugs174/pr418129/Target3.java b/tests/bugs174/pr418129/Target3.java new file mode 100644 index 000000000..cba868929 --- /dev/null +++ b/tests/bugs174/pr418129/Target3.java @@ -0,0 +1,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 {} diff --git a/tests/bugs174/pr418129/Target4.java b/tests/bugs174/pr418129/Target4.java new file mode 100644 index 000000000..4bae09c1f --- /dev/null +++ b/tests/bugs174/pr418129/Target4.java @@ -0,0 +1,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;} |