diff options
author | Andy Clement <aclement@gopivotal.com> | 2013-10-01 10:00:14 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2013-10-01 10:00:14 -0700 |
commit | 2393befbdf0ef3842b838591f7af08e7d1467e34 (patch) | |
tree | 52d5234db2b09a769ca61d8a7611afc513bf70f3 /tests/bugs174/pr418129 | |
parent | e51636db502218e63f3125b59087de93dd299c73 (diff) | |
download | aspectj-2393befbdf0ef3842b838591f7af08e7d1467e34.tar.gz aspectj-2393befbdf0ef3842b838591f7af08e7d1467e34.zip |
418129: annos on top most implementor method
Diffstat (limited to 'tests/bugs174/pr418129')
-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;} |