aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-11-27 21:30:47 +0000
committeraclement <aclement>2008-11-27 21:30:47 +0000
commit48ba3fea26bf31e702199528bd461eaff4cc535c (patch)
tree31719f1e83effb1d6c808e45ce03266d2b7b10b5
parent155a888d39e73a70fd4fe47de2c37ed593bb5459 (diff)
downloadaspectj-48ba3fea26bf31e702199528bd461eaff4cc535c.tar.gz
aspectj-48ba3fea26bf31e702199528bd461eaff4cc535c.zip
256669: itd parameter annotations copied to target
-rw-r--r--tests/bugs163/pr256669/Destination.java1
-rw-r--r--tests/bugs163/pr256669/Four.java40
-rw-r--r--tests/bugs163/pr256669/Introduction.java6
-rw-r--r--tests/bugs163/pr256669/SimpleTest.java22
-rw-r--r--tests/bugs163/pr256669/SomeAnnotation.java7
-rw-r--r--tests/bugs163/pr256669/Three.java31
-rw-r--r--tests/bugs163/pr256669/Two.java31
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java23
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/ajc163.xml40
9 files changed, 197 insertions, 4 deletions
diff --git a/tests/bugs163/pr256669/Destination.java b/tests/bugs163/pr256669/Destination.java
new file mode 100644
index 000000000..30852cabb
--- /dev/null
+++ b/tests/bugs163/pr256669/Destination.java
@@ -0,0 +1 @@
+public class Destination {}
diff --git a/tests/bugs163/pr256669/Four.java b/tests/bugs163/pr256669/Four.java
new file mode 100644
index 000000000..5d2a6747a
--- /dev/null
+++ b/tests/bugs163/pr256669/Four.java
@@ -0,0 +1,40 @@
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+
+
+interface I {}
+
+class D implements I {}
+
+aspect Introduction {
+ // ITD onto interface
+ public String I.helloWorld( @SomeAnnotation("xyz") String who) {
+ return "Hello " + who;
+ }
+}
+
+public class Four {
+ public static void main(String[] argv) throws Exception {
+ Class<D> clazz = D.class;
+ Method m = clazz.getMethod("helloWorld", String.class);
+ Annotation[] ann = m.getAnnotations();
+ for (int i = 0; i < m.getParameterAnnotations().length; i++) {
+ int count = m.getParameterAnnotations()[i].length;
+ System.out.println("Class D parameter " + i + " has " + count + " parameter annotations");
+ }
+ Class<I> clazzI = I.class;
+ m = clazzI.getMethod("helloWorld", String.class);
+ ann = m.getAnnotations();
+ for (int i = 0; i < m.getParameterAnnotations().length; i++) {
+ int count = m.getParameterAnnotations()[i].length;
+ System.out.println("Interface I parameter " + i + " has " + count + " parameter annotations");
+ }
+
+ }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@interface SomeAnnotation {
+ String value() default "";
+}
diff --git a/tests/bugs163/pr256669/Introduction.java b/tests/bugs163/pr256669/Introduction.java
new file mode 100644
index 000000000..8539a8551
--- /dev/null
+++ b/tests/bugs163/pr256669/Introduction.java
@@ -0,0 +1,6 @@
+privileged aspect Introduction {
+ public String Destination.helloWorld(@SomeAnnotation("xyz") String who) {
+ return "Hello " + who;
+ }
+}
+
diff --git a/tests/bugs163/pr256669/SimpleTest.java b/tests/bugs163/pr256669/SimpleTest.java
new file mode 100644
index 000000000..22303af65
--- /dev/null
+++ b/tests/bugs163/pr256669/SimpleTest.java
@@ -0,0 +1,22 @@
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+
+public class SimpleTest {
+ public static void main(String[] argv) throws Exception {
+ Class<Destination> clazz = Destination.class;
+ Method m = clazz.getMethod("helloWorld", String.class);
+ Annotation[] ann = m.getAnnotations();
+// System.out.println(m + " has " + ann.length + " annotations");
+
+ for (int i = 0; i < ann.length; i++) {
+// System.out.println("Method annotation: " + ann[i].getClass() + ann[i].toString());
+ }
+
+ for (int i = 0; i < m.getParameterAnnotations().length; i++) {
+ int count = m.getParameterAnnotations()[i].length;
+ System.out.println("Parameter " + i + " has " + count + " parameter annotations");
+ }
+
+ }
+}
+
diff --git a/tests/bugs163/pr256669/SomeAnnotation.java b/tests/bugs163/pr256669/SomeAnnotation.java
new file mode 100644
index 000000000..e12cde1c7
--- /dev/null
+++ b/tests/bugs163/pr256669/SomeAnnotation.java
@@ -0,0 +1,7 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+public @interface SomeAnnotation {
+ String value() default "";
+}
diff --git a/tests/bugs163/pr256669/Three.java b/tests/bugs163/pr256669/Three.java
new file mode 100644
index 000000000..dc487832d
--- /dev/null
+++ b/tests/bugs163/pr256669/Three.java
@@ -0,0 +1,31 @@
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+
+
+class Destination {}
+
+aspect Introduction {
+ // multiple parameters, not all annotated
+ public static String Destination.helloWorld(int i, @SomeAnnotation("xyz") String who, long l, @SomeAnnotation("abc") String what) {
+ return "Hello " + who;
+ }
+}
+
+public class Three {
+ public static void main(String[] argv) throws Exception {
+ Class<Destination> clazz = Destination.class;
+ Method m = clazz.getMethod("helloWorld", Integer.TYPE,String.class,Long.TYPE,String.class);
+ Annotation[] ann = m.getAnnotations();
+ for (int i = 0; i < m.getParameterAnnotations().length; i++) {
+ int count = m.getParameterAnnotations()[i].length;
+ System.out.println("Parameter " + i + " has " + count + " parameter annotations");
+ }
+
+ }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@interface SomeAnnotation {
+ String value() default "";
+}
diff --git a/tests/bugs163/pr256669/Two.java b/tests/bugs163/pr256669/Two.java
new file mode 100644
index 000000000..795825e51
--- /dev/null
+++ b/tests/bugs163/pr256669/Two.java
@@ -0,0 +1,31 @@
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+
+
+class Destination {}
+
+aspect Introduction {
+ // static ITD
+ public static String Destination.helloWorld(@SomeAnnotation("xyz") String who) {
+ return "Hello " + who;
+ }
+}
+
+public class Two {
+ public static void main(String[] argv) throws Exception {
+ Class<Destination> clazz = Destination.class;
+ Method m = clazz.getMethod("helloWorld", String.class);
+ Annotation[] ann = m.getAnnotations();
+ for (int i = 0; i < m.getParameterAnnotations().length; i++) {
+ int count = m.getParameterAnnotations()[i].length;
+ System.out.println("Parameter " + i + " has " + count + " parameter annotations");
+ }
+
+ }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@interface SomeAnnotation {
+ String value() default "";
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
index 7a38f7265..6107200df 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
@@ -23,6 +23,22 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testParameterAnnotationsOnITDs_pr256669() { // regular itd
+ runTest("parameter annotations on ITDs");
+ }
+
+ public void testParameterAnnotationsOnITDs_pr256669_2() { // static itd
+ runTest("parameter annotations on ITDs - 2");
+ }
+
+ public void testParameterAnnotationsOnITDs_pr256669_3() { // multiple parameters
+ runTest("parameter annotations on ITDs - 3");
+ }
+
+ public void testParameterAnnotationsOnITDs_pr256669_4() { // itd on interface
+ runTest("parameter annotations on ITDs - 4");
+ }
+
public void testOrderingIssue_1() {
runTest("ordering issue");
}
@@ -31,9 +47,9 @@ public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("ordering issue - 2");
}
-// public void testGenericPointcuts_5() {
-// runTest("generic pointcuts - 5");
-// }
+ // public void testGenericPointcuts_5() {
+ // runTest("generic pointcuts - 5");
+ // }
public void testGenericPointcuts_1() {
runTest("generic pointcuts - 1");
@@ -51,7 +67,6 @@ public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("generic pointcuts - 4");
}
-
// public void testBrokenLVT_pr194314_1() throws Exception {
// runTest("broken lvt - 1");
// JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(), "Service");
diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
index f3e82e8ed..ac29d0aa3 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
+++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
@@ -16,6 +16,46 @@
<message kind="error" line="1" text="Bound mismatch"/>
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs">
+ <compile files="Destination.java SimpleTest.java Introduction.java SomeAnnotation.java" options="-1.5"/>
+ <run class="SimpleTest">
+ <stdout>
+ <line text="Parameter 0 has 1 parameter annotations"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs - 2">
+ <compile files="Two.java" options="-1.5"/>
+ <run class="Two">
+ <stdout>
+ <line text="Parameter 0 has 1 parameter annotations"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs - 3">
+ <compile files="Three.java" options="-1.5"/>
+ <run class="Three">
+ <stdout>
+ <line text="Parameter 0 has 0 parameter annotations"/>
+ <line text="Parameter 1 has 1 parameter annotations"/>
+ <line text="Parameter 2 has 0 parameter annotations"/>
+ <line text="Parameter 3 has 1 parameter annotations"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs - 4">
+ <compile files="Four.java" options="-1.5"/>
+ <run class="Four">
+ <stdout>
+ <line text="Class D parameter 0 has 1 parameter annotations"/>
+ <line text="Interface I parameter 0 has 1 parameter annotations"/>
+ </stdout>
+ </run>
+ </ajc-test>
<ajc-test dir="bugs163/pr253109" title="generic pointcuts - 1">
<compile files="CodeOne.java" options="-1.5">