void (ControlFlowGraph graph) { Set<BasicBlock> setVisited = new HashSet<>(); for (ExceptionRangeCFG range : graph.getExceptions()) { BasicBlock handler = range.getHandler(); if (setVisited.contains(handler)) { continue; } setVisited.add(handler); BasicBlock emptyblock = new BasicBlock(++graph.last_id); graph.getBlocks().addWithKey(emptyblock, emptyblock.id); // only exception predecessors considered List<BasicBlock> lstTemp = new ArrayList<>(handler.getPredecessorExceptions()); // replace predecessors for (BasicBlock pred : lstTemp) { pred.replaceSuccessor(handler, emptyblock); } // replace handler for (ExceptionRangeCFG range_ext : graph.getExceptions()) { if (range_ext.getHandler() == handler) { range_ext.setHandler(emptyblock); } else if (range_ext.getProtectedRange().contains(handler)) { emptyblock.addSuccessorException(range_ext.getHandler()); range_ext.getProtectedRange().add(emptyblock); } } emptyblock.addSuccessor(handler); if (graph.getFirst() == handler) { graph.setFirst(emptyblock); } } }