private static void cleanUpTail(@NotNull PsiIfStatement ifStatement,
                                    @NotNull List<? extends PsiStatement> tailStatements,
                                    CommentTracker ct) {
      if (!tailStatements.isEmpty()) {
        for (PsiStatement statement : tailStatements) {
          ifStatement.getParent().addAfter(statement.copy(), ifStatement);
        }
        PsiStatement[] thenStatements = ControlFlowUtils.unwrapBlock(ifStatement.getThenBranch());
        PsiStatement[] elseStatements = ControlFlowUtils.unwrapBlock(ifStatement.getElseBranch());
        for (int i = thenStatements.length - 1; i >= 0; i--) {
          PsiStatement statement = thenStatements[i];
          if (!(statement instanceof PsiEmptyStatement)) break;
          //emptyStatementCount++;
        }
        if (thenStatements.length == 1 && thenStatements[0].getParent() == ifStatement) {
          thenStatements[0].replace(JavaPsiFacade.getElementFactory(ifStatement.getProject()).createCodeBlock());
        }
        else {
          deleteStatements(thenStatements, tailStatements.size(), ct, false);
        }
        deleteStatements(elseStatements, tailStatements.size(), ct, true);
      }
    }
private static void cleanUpTail(@NotNull PsiIfStatement ifStatement,
                                    @NotNull List<? extends PsiStatement> tailStatements,
                                    CommentTracker ct)