--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java Fri Jun 06 16:00:59 2014 -0400
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java Fri Jun 06 16:08:46 2014 -0400
@@ -25,6 +25,7 @@
/*
* @test
+ * @bug 8042451
* @summary Test population of reference info for method parameters
* @compile -g Driver.java ReferenceInfoUtil.java MethodParameters.java
* @run main Driver MethodParameters
@@ -41,97 +42,83 @@
return "void test(Object b, @TA Object a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 0 }, paramIndex = 0),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1 }, paramIndex = 0),
- @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
- })
public String methodParamAsParametrized() {
return "void test(@TA Map<@TB String, @TC List<@TD String>> a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 0 }, paramIndex = 0),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 0, 2, 0 }, paramIndex = 0),
- @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1 }, paramIndex = 0),
- @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1, 3, 0 }, paramIndex = 0),
- @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1, 3, 0, 2, 0 }, paramIndex = 0),
- @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0 }, paramIndex = 0),
- @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0, 2, 0 }, paramIndex = 0),
- @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1 }, paramIndex = 0),
- @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0, 2, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0, 2, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0, 2, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1, 2, 0 }, paramIndex = 0)
- })
public String methodParamAsWildcard() {
return "void test(@TA Map<@TB ? extends @TC String," +
" @TD List<@TE ? extends @TF Map<@TG ? super @TH String," +
" @TI ? extends @TJ Object>>> a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 0, 0 }, paramIndex = 1),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
- })
public String methodParamAsArray() {
return "void test(Object b, @TC String @TA [] @TB [] a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 0, 0 }, paramIndex = 1),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 0, 0 }, paramIndex = 1)
- })
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
public String methodParamAsArray2() {
return "void test(Object b, @TA @TB String [] a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 0, 0 }, paramIndex = 1),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 0, 0 }, paramIndex = 1),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 0, 0 }, paramIndex = 1)
- })
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
public String methodParamAsArray3() {
return "void test(Object b, @TA @TB @TC String [] a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 0, 0 }, paramIndex = 1),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
- })
public String methodParamAsVararg() {
return "void test(Object b, @TC String @TA [] @TB ... a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 0, 0 }, paramIndex = 1),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
- })
public String methodParamAsFQVararg() {
return "void test(Object b, java.lang.@TC String @TA [] @TB ... a) { }";
}
@@ -148,26 +135,125 @@
// Smoke tests
@TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
- public String interfacemethodParamAsObject() {
- return "interface Test { void test(@TA Object a); }";
+ public String interfaceMethodParamAsObject() {
+ return "interface %TEST_CLASS_NAME% { void test(@TA Object a); }";
}
@TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 2)
- public String abstractmethodParamAsObject() {
- return "abstract class Test { abstract void test(Object b, Object c, @TA Object a); }";
+ public String abstractMethodParamAsObject() {
+ return "abstract class %TEST_CLASS_NAME% { abstract void test(Object b, Object c, @TA Object a); }";
+ }
+
+ @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+ public String interfaceMethodParamAsParametrized() {
+ return "interface %TEST_CLASS_NAME% { void test(@TA Map<@TB String, @TC List<@TD String>> a); }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ public String methodParamAsPrimitiveRepeatableAnnotation() {
+ return "void test(@RTA @RTA int a) { }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ public String methodParamAsObjectRepeatableAnnotation() {
+ return "void test(Object b, @RTA @RTA Object a) { }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "RTDs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+ public String methodParamAsParametrizedRepeatableAnnotation() {
+ return "void test(@RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> a) { }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0, 2, 0 }, paramIndex = 0)
+ @TADescription(annotation = "RTDs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "RTEs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "RTFs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0, 2, 0 }, paramIndex = 0)
+ public String methodParamAsWildcardRepeatableAnnotation() {
+ return "void test(@RTA @RTA Map<@RTB @RTB ? extends @RTC @RTC String," +
+ " @RTD @RTD List<@RTE @RTE ? super @RTF @RTF String>> a) { }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
- @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 0 }, paramIndex = 0),
- @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1 }, paramIndex = 0),
- @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
- genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
- })
- public String interfacemethodParamAsParametrized() {
- return "interface Test { void test(@TA Map<@TB String, @TC List<@TD String>> a); }";
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
+ public String methodParamAsArrayRepeatableAnnotation() {
+ return "void test(Object b, @RTC @RTC String @RTA @RTA [] @RTB @RTB [] a) { }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ public String methodParamAsArrayRepeatableAnnotation2() {
+ return "void test(Object b, @RTA @RTA @RTB @RTB String [] a) { }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ public String methodParamAsArrayRepeatableAnnotation3() {
+ return "void test(Object b, @RTA @RTA @RTB @RTB String [] a) { }";
}
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
+ public String methodParamAsVarargRepeatableAnnoattion() {
+ return "void test(Object b, @RTC @RTC String @RTA @RTA [] @RTB @RTB ... a) { }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0 }, paramIndex = 1)
+ @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
+ public String methodParamAsFQVarargRepeatableAnnotation() {
+ return "void test(Object b, java.lang.@RTC @RTC String @RTA @RTA [] @RTB @RTB ... a) { }";
+ }
+
+ // Smoke tests
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ public String interfaceMethodParamAsObjectRepeatableAnnotation() {
+ return "interface %TEST_CLASS_NAME% { void test(@RTA @RTA Object a); }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 2)
+ public String abstractMethodParamAsObjectRepeatableAnnotation() {
+ return "abstract class %TEST_CLASS_NAME% { abstract void test(Object b, Object c, @RTA @RTA Object a); }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+ @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 0 }, paramIndex = 0)
+ @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1 }, paramIndex = 0)
+ @TADescription(annotation = "RTDs", type = METHOD_FORMAL_PARAMETER,
+ genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+ public String interfaceMethodParamAsParametrizedRepeatableAnnotation() {
+ return "interface %TEST_CLASS_NAME% { void test(@RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> a); }";
+ }
}