void (BasicBlock block) { while (block.getSuccessors().size() > 0) { block.removeSuccessor(block.getSuccessors().get(0)); } while (block.getSuccessorExceptions().size() > 0) { block.removeSuccessorException(block.getSuccessorExceptions().get(0)); } while (block.getPredecessors().size() > 0) { block.getPredecessors().get(0).removeSuccessor(block); } while (block.getPredecessorExceptions().size() > 0) { block.getPredecessorExceptions().get(0).removeSuccessorException(block); } last.removePredecessor(block); blocks.removeWithKey(block.id); for (int i = exceptions.size() - 1; i >= 0; i--) { ExceptionRangeCFG range = exceptions.get(i); if (range.getHandler() == block) { exceptions.remove(i); } else { List<BasicBlock> lstRange = range.getProtectedRange(); lstRange.remove(block); if (lstRange.isEmpty()) { exceptions.remove(i); } } } subroutines.entrySet().removeIf(ent -> ent.getKey() == block || ent.getValue() == block); }