private void buildChildren(final ArrayList<Block> result, final Alignment childAlignment, final Wrap childWrap) {
    ASTNode child = myNode.getFirstChildNode();
    ASTNode prevChild = null;

    int state = BEFORE_FIRST;

    while (child != null) {
      if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){
        final Indent indent = calcIndent(child,  state);
        myIndentsBefore.add(calcIndentBefore(child,  state));
        state = calcNewState(child, state);

        // The general idea is that it's possible that there are comment lines before method declaration line and that they have
        // different indents. Example:
        //
        //     // This is comment before method
        //               void foo() {}
        //
        // We want to have the comment and method as distinct blocks then in order to correctly process indentation for inner method
        // elements. See IDEA-53778 for example of situation when it is significant.
        if (prevChild != null && myNode.getElementType() == JavaElementType.METHOD
            && ElementType.JAVA_COMMENT_BIT_SET.contains(prevChild.getElementType())
            && !ElementType.JAVA_COMMENT_BIT_SET.contains(child.getElementType()))
        {
          prevChild = child;
          child = composeCodeBlock(result, child, Indent.getNoneIndent(), 0, null);
        }
        else {
          prevChild = child;
          Alignment simpleMethodBraceAlignment = myAlignmentStrategy.getAlignment(child.getElementType());
          Alignment toUse = childAlignment != null ? childAlignment : simpleMethodBraceAlignment;
          child = processChild(result, child, toUse, childWrap, indent);
        }
        for (int i = myIndentsBefore.size(); i < result.size(); i++) {
          myIndentsBefore.add(Indent.getContinuationIndent(myIndentSettings.USE_RELATIVE_INDENTS));
        }
      }
      if (child != null) {
        child = child.getTreeNext();
      }
    }
  }
private void buildChildren(final ArrayList<Block> result, final Alignment childAlignment, final Wrap childWrap)