public void visitVarDef(JCVariableDecl tree) { try { if (docComments != null && docComments.hasComment(tree)) { println(); align(); } printDocComment(tree); if ((tree.mods.flags & ENUM) != 0) { print("/*public static final*/ "); print(tree.name); if (tree.init != null) { if (sourceOutput && tree.init.hasTag(NEWCLASS)) { print(" /*enum*/ "); JCNewClass init = (JCNewClass) tree.init; if (init.args != null && init.args.nonEmpty()) { print("("); print(init.args); print(")"); } if (init.def != null && init.def.defs != null) { print(" "); printBlock(init.def.defs); } return; } print(" /* = "); printExpr(tree.init); print(" */"); } } else { printExpr(tree.mods); if ((tree.mods.flags & VARARGS) != 0) { JCTree vartype = tree.vartype; List<JCAnnotation> tas = null; if (vartype instanceof JCAnnotatedType) { tas = ((JCAnnotatedType) vartype).annotations; vartype = ((JCAnnotatedType) vartype).underlyingType; } printExpr(((JCArrayTypeTree) vartype).elemtype); if (tas != null) { print(' '); printTypeAnnotations(tas); } print("... " + tree.name); } else { printExpr(tree.vartype); print(" " + tree.name); } if (tree.init != null) { print(" = "); printExpr(tree.init); } if (prec == TreeInfo.notExpression) print(";"); } } catch (IOException e) { throw new UncheckedIOException(e); } }