List<Block> () { final ArrayList<Block> result = new ArrayList<>(); ArrayList<Block> elementsExceptKeyword = new ArrayList<>(); myChildAlignment = createChildAlignment(); myChildIndent = Indent.getContinuationIndent(myIndentSettings.USE_RELATIVE_INDENTS); myUseChildAttributes = true; Wrap childWrap = createChildWrap(); ASTNode child = myNode.getFirstChildNode(); Alignment alignment = alignList() ? Alignment.createAlignment() : null; while (child != null) { if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){ IElementType elementType = child.getElementType(); if (ElementType.KEYWORD_BIT_SET.contains(elementType)) { if (!elementsExceptKeyword.isEmpty()) { result.add(new SyntheticCodeBlock(elementsExceptKeyword, null, mySettings, myJavaSettings, Indent.getNoneIndent(), null)); elementsExceptKeyword = new ArrayList<>(); } Indent indent = mySettings.ALIGN_THROWS_KEYWORD && elementType == JavaTokenType.THROWS_KEYWORD ? Indent.getNoneIndent() : myChildIndent; result.add(createJavaBlock(child, mySettings, myJavaSettings, indent, arrangeChildWrap(child, childWrap), alignment, getFormattingMode())); } else { Alignment candidate = myAlignmentStrategy.getAlignment(elementType); if (candidate != null) { alignment = myChildAlignment = candidate; } processChild(elementsExceptKeyword, child, myChildAlignment, childWrap, myChildIndent); } } child = child.getTreeNext(); } if (!elementsExceptKeyword.isEmpty()) { result.add(new SyntheticCodeBlock(elementsExceptKeyword, alignment, mySettings, myJavaSettings, Indent.getNoneIndent(), null)); } return result; }