aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163/pr256669/Four.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs163/pr256669/Four.java')
-rw-r--r--tests/bugs163/pr256669/Four.java40
1 files changed, 40 insertions, 0 deletions
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 "";
+}