Program: 130391
Project: 130391
Buggy source:
@Override protected List<Block> buildChildren(){
  if (isLeaf()) {
    return EMPTY;
  }
  List<ASTNode> rawNodes=new ArrayList<>();
  for (ASTNode childNode=getNode().getFirstChildNode(); childNode != null; childNode=childNode.getTreeNext()) {
    rawNodes.add(childNode);
  }
  rawNodes.addAll(myAdditionalNodes);
  Deque<ASTNode> nodes=new ArrayDeque<>();
  List<ASTNode> whitespaces=null;
  List<ASTNode> disabledNodes=null;
  for (  ASTNode rawNode : rawNodes) {
    if (FormatterUtil.containsWhiteSpacesOnly(rawNode)) {
      if (disabledNodes != null) {
        disabledNodes.add(rawNode);
      }
 else {
        if (whitespaces == null) {
          whitespaces=new SmartList<>();
        }
        whitespaces.add(rawNode);
      }
      continue;
    }
    if (rawNode.getElementType() == CSharpTokens.NON_ACTIVE_SYMBOL) {
      if (disabledNodes == null) {
        disabledNodes=new ArrayList<>();
      }
      disabledNodes.add(rawNode);
    }
 else {
      if (disabledNodes != null) {
        ASTNode node=disabledNodes.get(disabledNodes.size() - 1);
        if (StringUtil.containsLineBreak(node.getChars())) {
          disabledNodes.remove(disabledNodes.remove(disabledNodes.size() - 1));
        }
        nodes.add(new CSharpDisabledBlock(disabledNodes));
      }
      disabledNodes=null;
      whitespaces=null;
      nodes.add(rawNode);
    }
  }
  List<Block> children=new ArrayList<>();
  ASTNode next;
  while ((next=nodes.poll()) != null) {
    BlockWithParent blockWithParent=null;
    if (next instanceof CSharpDisabledBlock) {
      blockWithParent=new CSharpDisabledFormattingBlock(next);
    }
 else {
      final CSharpFormattingBlock childBlock=new CSharpFormattingBlock(next,null,null,mySettings);
      blockWithParent=childBlock;
      IElementType elementType=next.getElementType();
      if (elementType == SWITCH_LABEL_STATEMENT) {
        ASTNode someNextElement;
        while ((someNextElement=nodes.poll()) != null) {
          IElementType someNextElementType=someNextElement.getElementType();
          if (someNextElementType == SWITCH_LABEL_STATEMENT || someNextElementType == RBRACE) {
            nodes.addFirst(someNextElement);
            break;
          }
          childBlock.addAdditionalNode(someNextElement);
        }
      }
    }
    blockWithParent.setParent(this);
    children.add((Block)blockWithParent);
  }
  return children;
}

Fixed version (ground truth):
@Override protected List<Block> buildChildren(){
  if (isLeaf()) {
    return EMPTY;
  }
  List<ASTNode> rawNodes=new ArrayList<>();
  for (ASTNode childNode=getNode().getFirstChildNode(); childNode != null; childNode=childNode.getTreeNext()) {
    rawNodes.add(childNode);
  }
  rawNodes.addAll(myAdditionalNodes);
  Deque<ASTNode> nodes=new ArrayDeque<>();
  List<ASTNode> whitespaces=null;
  List<ASTNode> disabledNodes=null;
  for (  ASTNode rawNode : rawNodes) {
    if (FormatterUtil.containsWhiteSpacesOnly(rawNode)) {
      if (disabledNodes != null) {
        disabledNodes.add(rawNode);
      }
 else {
        if (whitespaces == null) {
          whitespaces=new SmartList<>();
        }
        whitespaces.add(rawNode);
      }
      continue;
    }
    if (rawNode.getElementType() == CSharpTokens.NON_ACTIVE_SYMBOL) {
      if (disabledNodes == null) {
        disabledNodes=new ArrayList<>();
      }
      disabledNodes.add(rawNode);
    }
 else {
      if (disabledNodes != null) {
        ASTNode node=disabledNodes.get(disabledNodes.size() - 1);
        if (StringUtil.containsLineBreak(node.getChars())) {
          disabledNodes.remove(disabledNodes.remove(disabledNodes.size() - 1));
        }
        nodes.add(new CSharpDisabledBlock(disabledNodes));
      }
      disabledNodes=null;
      whitespaces=null;
      nodes.add(rawNode);
    }
  }
  if (disabledNodes != null) {
    nodes.add(new CSharpDisabledBlock(disabledNodes));
    disabledNodes=null;
    whitespaces=null;
  }
  List<Block> children=new ArrayList<>();
  ASTNode next;
  while ((next=nodes.poll()) != null) {
    BlockWithParent blockWithParent=null;
    if (next instanceof CSharpDisabledBlock) {
      blockWithParent=new CSharpDisabledFormattingBlock(next);
    }
 else {
      final CSharpFormattingBlock childBlock=new CSharpFormattingBlock(next,null,null,mySettings);
      blockWithParent=childBlock;
      IElementType elementType=next.getElementType();
      if (elementType == SWITCH_LABEL_STATEMENT) {
        ASTNode someNextElement;
        while ((someNextElement=nodes.poll()) != null) {
          IElementType someNextElementType=someNextElement.getElementType();
          if (someNextElementType == SWITCH_LABEL_STATEMENT || someNextElementType == RBRACE) {
            nodes.addFirst(someNextElement);
            break;
          }
          childBlock.addAdditionalNode(someNextElement);
        }
      }
    }
    blockWithParent.setParent(this);
    children.add((Block)blockWithParent);
  }
  return children;
}