--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Mon Apr 20 12:45:41 2015 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Tue Apr 21 12:10:26 2015 +0200
@@ -1293,9 +1293,21 @@
@DefinedBy(Api.LANGUAGE_MODEL)
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append(elemtype);
- appendAnnotationsString(sb, true);
- sb.append("[]");
+
+ // First append root component type
+ Type t = elemtype;
+ while (t.getKind() == TypeKind.ARRAY)
+ t = ((ArrayType) t).getComponentType();
+ sb.append(t);
+
+ // then append @Anno[] @Anno[] ... @Anno[]
+ t = this;
+ do {
+ t.appendAnnotationsString(sb, true);
+ sb.append("[]");
+ t = ((ArrayType) t).getComponentType();
+ } while (t.getKind() == TypeKind.ARRAY);
+
return sb.toString();
}