From 2314eaf48a35a249e63fae12151ce926ea98c97c Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Tue, 1 Oct 2013 10:00:14 -0700 Subject: 418129: annos on top most implementor method --- tests/bugs174/pr418129/Target.java | 27 ++++++++++ tests/bugs174/pr418129/Target2.java | 27 ++++++++++ tests/bugs174/pr418129/Target3.java | 27 ++++++++++ tests/bugs174/pr418129/Target4.java | 25 +++++++++ .../org/aspectj/systemtest/ajc174/Ajc174Tests.java | 16 ++++++ tests/src/org/aspectj/systemtest/ajc174/ajc174.xml | 61 ++++++++++++++++++++++ 6 files changed, 183 insertions(+) create mode 100644 tests/bugs174/pr418129/Target.java create mode 100644 tests/bugs174/pr418129/Target2.java create mode 100644 tests/bugs174/pr418129/Target3.java create mode 100644 tests/bugs174/pr418129/Target4.java (limited to 'tests') 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;} diff --git a/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java b/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java index 06af6a53b..1e300dd0a 100644 --- a/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java @@ -21,6 +21,22 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc174Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testAnnotatedItd_418129() throws Exception { + runTest("annotated itd"); + } + + public void testAnnotatedItd_418129_2() throws Exception { + runTest("annotated itd 2"); + } + + public void testAnnotatedItd_418129_3() throws Exception { + runTest("annotated itd 3"); + } + + public void testAnnotatedItd_418129_4() throws Exception { + runTest("annotated itd 4"); + } + public void testSuperItdCtor_413378() throws Exception { runTest("super itd ctor"); } diff --git a/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml b/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml index 85ff2af8b..5b47cf4d3 100644 --- a/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml +++ b/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml @@ -2,6 +2,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3