--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java Fri Jun 06 16:00:59 2014 -0400
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java Fri Jun 06 16:08:46 2014 -0400
@@ -25,6 +25,7 @@
/*
* @test
+ * @bug 8042451
* @summary Test population of reference info for method return
* @compile -g Driver.java ReferenceInfoUtil.java MethodReturns.java
* @run main Driver MethodReturns
@@ -42,37 +43,31 @@
return "@TA Object test() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 1 }),
- @TADescription(annotation = "TD", type = METHOD_RETURN,
- genericLocation = { 3, 1, 3, 0 })
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN)
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 1 })
+ @TADescription(annotation = "TD", type = METHOD_RETURN,
+ genericLocation = { 3, 1, 3, 0 })
public String methodReturnAsParametrized() {
return "@TA Map<@TB String, @TC List<@TD String>> test() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 0, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 0, 0, 0, 0 })
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN)
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 0, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 0, 0, 0, 0 })
public String methodReturnAsArray() {
return "@TC String @TA [] @TB [] test() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 0, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 0, 0, 0, 0 })
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN)
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 0, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 0, 0, 0, 0 })
public String methodReturnAsArrayOld() {
return "@TC String test() @TA [] @TB [] { return null; }";
}
@@ -90,97 +85,206 @@
// Smoke tests
@TADescription(annotation = "TA", type = METHOD_RETURN)
public String interfaceMethodReturnAsObject() {
- return "interface Test { @TA Object test(); }";
+ return "interface %TEST_CLASS_NAME% { @TA Object test(); }";
}
@TADescription(annotation = "TA", type = METHOD_RETURN)
public String abstractMethodReturnAsObject() {
- return "abstract class Test { abstract @TA Object test(); }";
+ return "abstract class %TEST_CLASS_NAME% { abstract @TA Object test(); }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 1 }),
- @TADescription(annotation = "TD", type = METHOD_RETURN,
- genericLocation = { 3, 1, 3, 0 })
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN)
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 1 })
+ @TADescription(annotation = "TD", type = METHOD_RETURN,
+ genericLocation = { 3, 1, 3, 0 })
public String interfaceMethodReturnAsParametrized() {
- return "interface Test { @TA Map<@TB String, @TC List<@TD String>> test(); }";
+ return "interface %TEST_CLASS_NAME% { @TA Map<@TB String, @TC List<@TD String>> test(); }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN,
- genericLocation = { 3, 0 }),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0 }),
- @TADescription(annotation = "TD", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 }),
- @TADescription(annotation = "TE", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 }),
- @TADescription(annotation = "TF", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1, 2, 0 })
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN,
+ genericLocation = { 3, 0 })
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
+ @TADescription(annotation = "TD", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 })
+ @TADescription(annotation = "TE", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 })
+ @TADescription(annotation = "TF", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1, 2, 0 })
public String methodReturnAsNestedWildcard() {
return "Set<@TA ? extends @TB GOuter<String, String>. @TC GInner<@TD String, @TE ? super @TF Object>> entrySet() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN,
- genericLocation = { 3, 0, 1, 0, 3, 0 }),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0, 1, 0, 3, 1 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 0, 1, 0, 3, 1, 2, 0 })
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 1, 0, 3, 0 })
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 1, 0, 3, 1 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 1, 0, 3, 1, 2, 0 })
public String methodReturnAsNestedWildcard2() {
return "class GOuter<X, Y> { class GInner<X, Y> {} } " +
- "class Test<K> { Set<GOuter<String, String>.GInner<@TA K, @TB ? extends @TC Object>> entrySet() { return null; } }";
+ "class %TEST_CLASS_NAME%<K> { Set<GOuter<String, String>.GInner<@TA K, @TB ? extends @TC Object>> entrySet() { return null; } }";
}
- @TADescriptions({
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0 }),
- })
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
public String methodReturnAsNestedWildcard3() {
return "Set<? extends @TB GOuter<String, String>. @TC GInner<String, Object>> entrySet() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0 }),
- })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
public String methodReturnAsNestedWildcard4() {
return "Set<? extends GOuter<String, String>. @TC GInner<String, Object>> entrySet() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0 }),
- })
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
public String methodReturnAsNestedWildcard5() {
return "Set<? extends @TB Outer. @TC Inner> entrySet() { return null; }";
}
- @TADescriptions({
- @TADescription(annotation = "TA", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 }),
- @TADescription(annotation = "TB", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 }),
- @TADescription(annotation = "TC", type = METHOD_RETURN,
- genericLocation = { 3, 0, 2, 0, 1, 0 }),
- })
+ @TADescription(annotation = "TA", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 })
+ @TADescription(annotation = "TB", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 })
+ @TADescription(annotation = "TC", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
public String methodReturnAsNestedWildcard6() {
return "Set<? extends GOuter<String, String>. @TC GInner<@TA String, @TB Object>> entrySet() { return null; }";
}
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ public String methodReturnAsPrimitiveRepeatableAnnotation() {
+ return "@RTA @RTA int test() { return 0; }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ public String methodReturnAsObjectRepeatableAnnotation() {
+ return "@RTA @RTA Object test() { return null; }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 1 })
+ @TADescription(annotation = "RTDs", type = METHOD_RETURN,
+ genericLocation = { 3, 1, 3, 0 })
+ public String methodReturnAsParametrizedRepeatableAnnotation() {
+ return "@RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> test() { return null; }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 0, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 0, 0, 0, 0 })
+ public String methodReturnAsArrayRepeatableAnnotation() {
+ return "@RTC @RTC String @RTA @RTA [] @RTB @RTB [] test() { return null; }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 0, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 0, 0, 0, 0 })
+ public String methodReturnAsArrayOldRepeatableAnnotation() {
+ return "@RTC @RTC String test() @RTA @RTA [] @RTB @RTB [] { return null; }";
+ }
+
+ // Smoke tests
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ public String interfaceMethodReturnAsObjectRepeatableAnnotation() {
+ return "interface %TEST_CLASS_NAME% { @RTA @RTA Object test(); }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ public String abstractMethodReturnAsObjectRepeatableAnnotation() {
+ return "abstract class %TEST_CLASS_NAME% { abstract @RTA @RTA Object test(); }";
+ }
+
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 1 })
+ @TADescription(annotation = "RTDs", type = METHOD_RETURN,
+ genericLocation = { 3, 1, 3, 0 })
+ public String interfaceMethodReturnAsParametrizedRepeatableAnnotation() {
+ return "interface %TEST_CLASS_NAME% { @RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> test(); }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN,
+ genericLocation = { 3, 0 })
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
+ @TADescription(annotation = "RTDs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 })
+ @TADescription(annotation = "RTEs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 })
+ @TADescription(annotation = "RTFs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1, 2, 0 })
+ public String methodReturnAsNestedWildcardRepeatableAnnotation() {
+ return "Set<@RTA @RTA ? extends @RTB @RTB GOuter<String, String>. @RTC @RTC GInner<@RTD @RTD String," +
+ " @RTE @RTE ? super @RTF @RTF Object>> entrySet() { return null; }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 1, 0, 3, 0 })
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 1, 0, 3, 1 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 1, 0, 3, 1, 2, 0 })
+ public String methodReturnAsNestedWildcardRepeatableAnnotation2() {
+ return "class GOuter<X, Y> { class GInner<X, Y> {} } " +
+ "class %TEST_CLASS_NAME%<K> { Set<GOuter<String, String>.GInner<@RTA @RTA K," +
+ " @RTB @RTB ? extends @RTC @RTC Object>> entrySet() { return null; } }";
+ }
+
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
+ public String methodReturnAsNestedWildcardRepeatableAnnotation3() {
+ return "Set<? extends @RTB @RTB GOuter<String, String>. @RTC @RTC GInner<String, Object>> entrySet() { return null; }";
+ }
+
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
+ public String methodReturnAsNestedWildcardRepeatableAnnotation4() {
+ return "Set<? extends GOuter<String, String>. @RTC @RTC GInner<String, Object>> entrySet() { return null; }";
+ }
+
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
+ public String methodReturnAsNestedWildcardRepeatableAnnotation5() {
+ return "Set<? extends @RTB @RTB Outer. @RTC @RTC Inner> entrySet() { return null; }";
+ }
+
+ @TADescription(annotation = "RTAs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 })
+ @TADescription(annotation = "RTBs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 })
+ @TADescription(annotation = "RTCs", type = METHOD_RETURN,
+ genericLocation = { 3, 0, 2, 0, 1, 0 })
+ public String methodReturnAsNestedWildcardRepeatableAnnotation6() {
+ return "Set<? extends GOuter<String, String>. @RTC @RTC GInner<@RTA @RTA String," +
+ " @RTB @RTB Object>> entrySet() { return null; }";
+ }
}