void (final ControlFlowGraph graph) { GenericDominatorEngine engine = new GenericDominatorEngine(new IGraph() { @Override public List<? extends IGraphNode> getReversePostOrderList() { return graph.getReversePostOrder(); } @Override public Set<? extends IGraphNode> getRoots() { return new HashSet<>(Collections.singletonList(graph.getFirst())); } }); engine.initialize(); List<ExceptionRangeCFG> lstRanges = graph.getExceptions(); for (int i = lstRanges.size() - 1; i >= 0; i--) { ExceptionRangeCFG range = lstRanges.get(i); BasicBlock handler = range.getHandler(); List<BasicBlock> rangeList = range.getProtectedRange(); if (rangeList.contains(handler)) { // TODO: better removing strategy List<BasicBlock> lstRemBlocks = getReachableBlocksRestricted(range.getHandler(), range, engine); if (lstRemBlocks.size() < rangeList.size() || rangeList.size() == 1) { for (BasicBlock block : lstRemBlocks) { block.removeSuccessorException(handler); rangeList.remove(block); } } if (rangeList.isEmpty()) { lstRanges.remove(i); } } } }