1.1 --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Tue May 14 13:55:35 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Tue May 14 15:04:06 2013 -0700 1.3 @@ -261,8 +261,6 @@ 1.4 } 1.5 1.6 public void printTypeAnnotations(List<JCAnnotation> trees) throws IOException { 1.7 - if (trees.nonEmpty()) 1.8 - print(" "); 1.9 for (List<JCAnnotation> l = trees; l.nonEmpty(); l = l.tail) { 1.10 printExpr(l.head); 1.11 print(" "); 1.12 @@ -564,8 +562,10 @@ 1.13 vartype = ((JCAnnotatedType)vartype).underlyingType; 1.14 } 1.15 printExpr(((JCArrayTypeTree) vartype).elemtype); 1.16 - if (tas != null) 1.17 + if (tas != null) { 1.18 + print(' '); 1.19 printTypeAnnotations(tas); 1.20 + } 1.21 print("... " + tree.name); 1.22 } else { 1.23 printExpr(tree.vartype); 1.24 @@ -918,6 +918,9 @@ 1.25 printExprs(tree.typeargs); 1.26 print(">"); 1.27 } 1.28 + if (tree.def != null && tree.def.mods.annotations.nonEmpty()) { 1.29 + printTypeAnnotations(tree.def.mods.annotations); 1.30 + } 1.31 printExpr(tree.clazz); 1.32 print("("); 1.33 printExprs(tree.args); 1.34 @@ -948,7 +951,8 @@ 1.35 int i = 0; 1.36 List<List<JCAnnotation>> da = tree.dimAnnotations; 1.37 for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) { 1.38 - if (da.size() > i) { 1.39 + if (da.size() > i && !da.get(i).isEmpty()) { 1.40 + print(' '); 1.41 printTypeAnnotations(da.get(i)); 1.42 } 1.43 print("["); 1.44 @@ -958,6 +962,7 @@ 1.45 } 1.46 if (tree.elems != null) { 1.47 if (isElemAnnoType) { 1.48 + print(' '); 1.49 printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations); 1.50 } 1.51 print("[]"); 1.52 @@ -1264,6 +1269,7 @@ 1.53 JCAnnotatedType atype = (JCAnnotatedType) elem; 1.54 elem = atype.underlyingType; 1.55 if (!elem.hasTag(TYPEARRAY)) break; 1.56 + print(' '); 1.57 printTypeAnnotations(atype.annotations); 1.58 } 1.59 print("[]"); 1.60 @@ -1301,6 +1307,9 @@ 1.61 1.62 public void visitTypeParameter(JCTypeParameter tree) { 1.63 try { 1.64 + if (tree.annotations.nonEmpty()) { 1.65 + this.printTypeAnnotations(tree.annotations); 1.66 + } 1.67 print(tree.name); 1.68 if (tree.bounds.nonEmpty()) { 1.69 print(" extends "); 1.70 @@ -1379,6 +1388,7 @@ 1.71 } else if (tree.underlyingType.getKind() == JCTree.Kind.ARRAY_TYPE) { 1.72 JCArrayTypeTree array = (JCArrayTypeTree) tree.underlyingType; 1.73 printBaseElementType(tree); 1.74 + print(' '); 1.75 printTypeAnnotations(tree.annotations); 1.76 print("[]"); 1.77 JCExpression elem = array.elemtype;