langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java
changeset 24896 986d876a9121
parent 24895 dd091d389fbf
child 30730 d3ce7619db2c
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Fri Jun 06 16:00:59 2014 -0400
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Fri Jun 06 16:08:46 2014 -0400
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @bug 8042451
  * @summary Test population of reference info for field
  * @compile -g Driver.java ReferenceInfoUtil.java Fields.java
  * @run main Driver Fields
@@ -41,37 +42,31 @@
         return "@TA Object test;";
     }
 
-    @TADescriptions({
-        @TADescription(annotation = "TA", type = FIELD),
-        @TADescription(annotation = "TB", type = FIELD,
-                genericLocation = { 3, 0 }),
-        @TADescription(annotation = "TC", type = FIELD,
-                genericLocation = { 3, 1 }),
-        @TADescription(annotation = "TD", type = FIELD,
-                genericLocation = { 3, 1, 3, 0 })
-    })
+    @TADescription(annotation = "TA", type = FIELD)
+    @TADescription(annotation = "TB", type = FIELD,
+            genericLocation = { 3, 0 })
+    @TADescription(annotation = "TC", type = FIELD,
+            genericLocation = { 3, 1 })
+    @TADescription(annotation = "TD", type = FIELD,
+            genericLocation = { 3, 1, 3, 0 })
     public String fieldAsParametrized() {
         return "@TA Map<@TB String, @TC List<@TD String>> test;";
     }
 
-    @TADescriptions({
-        @TADescription(annotation = "TA", type = FIELD),
-        @TADescription(annotation = "TB", type = FIELD,
-                genericLocation = { 0, 0 }),
-        @TADescription(annotation = "TC", type = FIELD,
-                genericLocation = { 0, 0, 0, 0 })
-    })
+    @TADescription(annotation = "TA", type = FIELD)
+    @TADescription(annotation = "TB", type = FIELD,
+            genericLocation = { 0, 0 })
+    @TADescription(annotation = "TC", type = FIELD,
+            genericLocation = { 0, 0, 0, 0 })
     public String fieldAsArray() {
         return "@TC String @TA [] @TB [] test;";
     }
 
-    @TADescriptions({
-        @TADescription(annotation = "TA", type = FIELD),
-        @TADescription(annotation = "TB", type = FIELD,
-                genericLocation = { 0, 0 }),
-        @TADescription(annotation = "TC", type = FIELD,
-                genericLocation = { 0, 0, 0, 0 })
-    })
+    @TADescription(annotation = "TA", type = FIELD)
+    @TADescription(annotation = "TB", type = FIELD,
+            genericLocation = { 0, 0 })
+    @TADescription(annotation = "TC", type = FIELD,
+            genericLocation = { 0, 0, 0, 0 })
     public String fieldAsArrayOld() {
         return "@TC String test @TA [] @TB [];";
     }
@@ -88,39 +83,108 @@
 
     // Smoke tests
     @TADescription(annotation = "TA", type = FIELD)
-    public String interfacefieldAsObject() {
-        return "interface Test { @TA String test = null; }";
+    public String interfaceFieldAsObject() {
+        return "interface %TEST_CLASS_NAME% { @TA String test = null; }";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD)
+    public String abstractFieldAsObject() {
+        return "abstract class %TEST_CLASS_NAME% { @TA String test; }";
     }
 
     @TADescription(annotation = "TA", type = FIELD)
-    public String abstractfieldAsObject() {
-        return "abstract class Test { @TA String test; }";
-    }
-
-    @TADescriptions({
-        @TADescription(annotation = "TA", type = FIELD),
-        @TADescription(annotation = "TB", type = FIELD,
-                genericLocation = { 3, 0 }),
-        @TADescription(annotation = "TC", type = FIELD,
-                genericLocation = { 3, 1 }),
-        @TADescription(annotation = "TD", type = FIELD,
-                genericLocation = { 3, 1, 3, 0 })
-    })
-    public String interfacefieldAsParametrized() {
-        return "interface Test { @TA Map<@TB String, @TC List<@TD String>> test = null; }";
+    @TADescription(annotation = "TB", type = FIELD,
+            genericLocation = { 3, 0 })
+    @TADescription(annotation = "TC", type = FIELD,
+            genericLocation = { 3, 1 })
+    @TADescription(annotation = "TD", type = FIELD,
+            genericLocation = { 3, 1, 3, 0 })
+    public String interfaceFieldAsParametrized() {
+        return "interface %TEST_CLASS_NAME% { @TA Map<@TB String, @TC List<@TD String>> test = null; }";
     }
 
 
-    @TADescriptions({
-        @TADescription(annotation = "TA", type = FIELD),
-        @TADescription(annotation = "TB", type = FIELD,
-                genericLocation = { 3, 0 }),
-        @TADescription(annotation = "TC", type = FIELD,
-                genericLocation = { 3, 1 }),
-        @TADescription(annotation = "TD", type = FIELD,
-                genericLocation = { 3, 1, 3, 0 })
-    })
+    @TADescription(annotation = "TA", type = FIELD)
+    @TADescription(annotation = "TB", type = FIELD,
+            genericLocation = { 3, 0 })
+    @TADescription(annotation = "TC", type = FIELD,
+            genericLocation = { 3, 1 })
+    @TADescription(annotation = "TD", type = FIELD,
+            genericLocation = { 3, 1, 3, 0 })
     public String staticFieldAsParametrized() {
         return "static @TA Map<@TB String, @TC List<@TD String>> test;";
     }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    public String fieldAsPrimitiveRepeatableAnnotation() {
+        return "@RTA @RTA int test;";
+    }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    public String fieldAsObjectRepeatableAnnotation() {
+        return "@RTA @RTA Object test;";
+    }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    @TADescription(annotation = "RTBs", type = FIELD,
+            genericLocation = { 3, 0 })
+    @TADescription(annotation = "RTCs", type = FIELD,
+            genericLocation = { 3, 1 })
+    @TADescription(annotation = "RTDs", type = FIELD,
+            genericLocation = { 3, 1, 3, 0 })
+    public String fieldAsParametrizedRepeatableAnnotation() {
+        return "@RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> test;";
+    }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    @TADescription(annotation = "RTBs", type = FIELD,
+            genericLocation = { 0, 0 })
+    @TADescription(annotation = "RTCs", type = FIELD,
+            genericLocation = { 0, 0, 0, 0 })
+    public String fieldAsArrayRepeatableAnnotation() {
+        return "@RTC @RTC String @RTA @RTA [] @RTB @RTB [] test;";
+    }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    @TADescription(annotation = "RTBs", type = FIELD,
+           genericLocation = { 0, 0 })
+    @TADescription(annotation = "RTCs", type = FIELD,
+            genericLocation = { 0, 0, 0, 0 })
+    public String fieldAsArrayOldRepeatableAnnotation() {
+        return "@RTC @RTC String test @RTA @RTA [] @RTB @RTB [];";
+    }
+
+    // Smoke tests
+    @TADescription(annotation = "RTAs", type = FIELD)
+    public String interfaceFieldAsObjectRepeatableAnnotation() {
+        return "interface %TEST_CLASS_NAME% { @RTA @RTA String test = null; }";
+    }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    public String abstractFieldAsObjectRepeatableAnnotation() {
+        return "abstract class %TEST_CLASS_NAME% { @RTA @RTA String test; }";
+    }
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    @TADescription(annotation = "RTBs", type = FIELD,
+            genericLocation = { 3, 0 })
+    @TADescription(annotation = "RTCs", type = FIELD,
+            genericLocation = { 3, 1 })
+    @TADescription(annotation = "RTDs", type = FIELD,
+            genericLocation = { 3, 1, 3, 0 })
+    public String interfaceFieldAsParametrizedRepeatableAnnotation() {
+        return "interface %TEST_CLASS_NAME% { @RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> test = null; }";
+    }
+
+
+    @TADescription(annotation = "RTAs", type = FIELD)
+    @TADescription(annotation = "RTBs", type = FIELD,
+            genericLocation = { 3, 0 })
+    @TADescription(annotation = "RTCs", type = FIELD,
+            genericLocation = { 3, 1 })
+    @TADescription(annotation = "RTDs", type = FIELD,
+            genericLocation = { 3, 1, 3, 0 })
+    public String staticFieldAsParametrizedRepeatableAnnotation() {
+        return "static @RTA @RTA Map<@RTB @RTB String, @RTC @RTC List<@RTD @RTD String>> test;";
+    }
 }