private static void removeEmptyStatements(SequenceStatement sequence) {

    if (sequence.getStats().size() <= 1) {
      return;
    }

    mergeFlatStatements(sequence);

    while (true) {

      boolean found = false;

      for (Statement st : sequence.getStats()) {

        if (st.getExprents() != null && st.getExprents().isEmpty()) {

          if (st.getAllSuccessorEdges().isEmpty()) {
            List<StatEdge> lstBreaks = st.getPredecessorEdges(EdgeType.BREAK);

            if (lstBreaks.isEmpty()) {
              for (StatEdge edge : st.getAllPredecessorEdges()) {
                edge.getSource().removeSuccessor(edge);
              }
              found = true;
            }
          }
          else {
            StatEdge sucedge = st.getAllSuccessorEdges().get(0);
            if (sucedge.getType() != EdgeType.FINALLY_EXIT) {
              st.removeSuccessor(sucedge);

              for (StatEdge edge : st.getAllPredecessorEdges()) {
                if (sucedge.getType() != EdgeType.REGULAR) {
                  edge.getSource().changeEdgeType(EdgeDirection.FORWARD, edge, sucedge.getType());
                }

                st.removePredecessor(edge);
                edge.getSource().changeEdgeNode(EdgeDirection.FORWARD, edge, sucedge.getDestination());
                sucedge.getDestination().addPredecessor(edge);

                if (sucedge.closure != null) {
                  sucedge.closure.addLabeledEdge(edge);
                }
              }
              found = true;
            }
          }

          if (found) {
            sequence.getStats().removeWithKey(st.id);
            break;
          }
        }
      }

      if (!found) {
        break;
      }
    }

    sequence.setFirst(sequence.getStats().get(0));
  }
private static void removeEmptyStatements(SequenceStatement sequence)