aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163/pr256669/Two.java
blob: 795825e5120c3febe7430d0bb7e2e82f3ccd87d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 "";
}