@Override public void visitWhileLoop(JCWhileLoop tree) { print("while"); print(cs.spaceBeforeWhileParen() ? " (" : "("); if (cs.spaceWithinWhileParens()) print(' '); printNoParenExpr(tree.cond); print(cs.spaceWithinWhileParens() ? " )" : ")"); printIndentedStat(tree.body, cs.redundantWhileBraces(), cs.spaceBeforeWhileLeftBrace(), cs.wrapWhileStatement()); }
@Override public Boolean visitWhileLoop(WhileLoopTree node, Void p) { accept(WHILE); boolean old = continuationIndent; try { continuationIndent = true; spaces(cs.spaceBeforeWhileParen() ? 1 : 0); scan(node.getCondition(), p); } finally { continuationIndent = old; } lastIndent = indent; CodeStyle.BracesGenerationStyle redundantWhileBraces = cs.redundantWhileBraces(); if (redundantWhileBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node) || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)) redundantWhileBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; wrapStatement(cs.wrapWhileStatement(), redundantWhileBraces, cs.spaceBeforeWhileLeftBrace() ? 1 : 0, node.getStatement()); return true; }
public void printBlock(JCTree oldT, JCTree newT, Kind parentKind) { switch (parentKind) { case ENHANCED_FOR_LOOP: case FOR_LOOP: printIndentedStat(newT, cs.redundantForBraces(), cs.spaceBeforeForLeftBrace(), cs.wrapForStatement()); break; case WHILE_LOOP: printIndentedStat(newT, cs.redundantWhileBraces(), cs.spaceBeforeWhileLeftBrace(), cs.wrapWhileStatement()); break; case IF: printIndentedStat(newT, cs.redundantIfBraces(), cs.spaceBeforeIfLeftBrace(), cs.wrapIfStatement()); break; case DO_WHILE_LOOP: printIndentedStat(newT, cs.redundantDoWhileBraces(), cs.spaceBeforeDoLeftBrace(), cs.wrapDoWhileStatement()); if (cs.placeWhileOnNewLine()) { newline(); toLeftMargin(); } else if (cs.spaceBeforeWhile()) { needSpace(); } } }
case WHILE_LOOP: bracePlacement = cs.getOtherBracePlacement(); spaceBeforeLeftBrace = cs.spaceBeforeWhileLeftBrace(); break; case FOR_LOOP: