aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-06-08 14:21:45 +0000
committeraclement <aclement>2005-06-08 14:21:45 +0000
commit57e97a0d145110253538f0239213b314ec815f46 (patch)
tree2d1b04ea52e0e1d58cd836b7dee2a6513e3e35fd /tests
parent9e8ff934c46e4169bdcaebb64d5d752540bb95b5 (diff)
downloadaspectj-57e97a0d145110253538f0239213b314ec815f46.tar.gz
aspectj-57e97a0d145110253538f0239213b314ec815f46.zip
Tests and fixes for 98901: annotation copying on public ITDs
Diffstat (limited to 'tests')
-rw-r--r--tests/java5/annotations/itds/AtItd2.aj29
-rw-r--r--tests/java5/annotations/itds/AtItd3.aj37
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Annotations.java12
3 files changed, 78 insertions, 0 deletions
diff --git a/tests/java5/annotations/itds/AtItd2.aj b/tests/java5/annotations/itds/AtItd2.aj
new file mode 100644
index 000000000..d96984c72
--- /dev/null
+++ b/tests/java5/annotations/itds/AtItd2.aj
@@ -0,0 +1,29 @@
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Ann {}
+
+aspect X {
+ @Ann public void AtItd2.m() {}
+}
+
+public class AtItd2 {
+ public static void main(String []argv) {
+ try {
+ Method m = AtItd2.class.getDeclaredMethod("m",null);
+ System.err.println("Method is "+m);
+ Annotation[] as = m.getDeclaredAnnotations();
+ System.err.println("Number of annotations "+
+ (as==null?"0":new Integer(as.length).toString()));
+ Annotation aa = m.getAnnotation(Ann.class);
+ System.err.println("Ann.class retrieved is: "+aa);
+ if (as.length==0)
+ throw new RuntimeException("Couldn't find annotation on member!");
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/tests/java5/annotations/itds/AtItd3.aj b/tests/java5/annotations/itds/AtItd3.aj
new file mode 100644
index 000000000..bc6c671f9
--- /dev/null
+++ b/tests/java5/annotations/itds/AtItd3.aj
@@ -0,0 +1,37 @@
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Ann {
+ String id() default "hello";
+ int anInt() default 5;
+}
+
+aspect X {
+ @Ann(id="goodbye",anInt=4) public void AtItd3.m() {}
+}
+
+public class AtItd3 {
+ public static void main(String []argv) {
+ try {
+ Method m = AtItd3.class.getDeclaredMethod("m",null);
+ System.err.println("Method is "+m);
+ Annotation[] as = m.getDeclaredAnnotations();
+ System.err.println("Number of annotations "+
+ (as==null?"0":new Integer(as.length).toString()));
+ Annotation aa = m.getAnnotation(Ann.class);
+ System.err.println("Ann.class retrieved is: "+aa);
+
+ if (!aa.toString().equals("@Ann(id=goodbye, anInt=4)"))
+ throw new RuntimeException("Incorrect output, expected:"+
+ "@Ann(id=goodbye, anInt=4) but got "+aa.toString());
+
+ if (as.length==0)
+ throw new RuntimeException("Couldn't find annotation on member!");
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Annotations.java b/tests/src/org/aspectj/systemtest/ajc150/Annotations.java
index 3a099a2ab..8c9fc2256 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Annotations.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Annotations.java
@@ -78,7 +78,19 @@ public class Annotations extends XMLBasedAjcTestCase {
public void testAnnotatedITDs() {
runTest("annotated itds");
}
+
+ public void testAnnotatedITDs2() {
+ runTest("annotated public itds");
+ }
+
+ public void testAnnotatedITDs3() {
+ runTest("annotated public itds - values");
+ }
+ public void testAnnotatedITDs4() {
+ runTest("annotated public itds - multiple complex annotations");
+ }
+
public void testAnnotatedITDsWithWrongAnnotationType() {
runTest("annotated itds with bad target");
}