void (Statement stat) { cancellationManager.checkCanceled(); Statement head = stat.getFirst(); Statement post = stat.getPost(); VBStyleCollection<Statement, Integer> setNodes = stat.getStats(); // post edges if (post != null) { for (StatEdge edge : post.getEdges(EdgeType.DIRECT_ALL, EdgeDirection.BACKWARD)) { if (stat.containsStatementStrict(edge.getSource())) { edge.getSource().changeEdgeType(EdgeDirection.FORWARD, edge, EdgeType.BREAK); stat.addLabeledEdge(edge); } } } // regular head edges for (StatEdge prededge : head.getAllPredecessorEdges()) { cancellationManager.checkCanceled(); if (prededge.getType() != EdgeType.EXCEPTION && stat.containsStatementStrict(prededge.getSource())) { prededge.getSource().changeEdgeType(EdgeDirection.FORWARD, prededge, EdgeType.CONTINUE); stat.addLabeledEdge(prededge); } head.removePredecessor(prededge); prededge.getSource().changeEdgeNode(EdgeDirection.FORWARD, prededge, stat); stat.addPredecessor(prededge); } if (setNodes.containsKey(first.id)) { first = stat; } // exception edges Set<Statement> setHandlers = new HashSet<>(head.getNeighbours(EdgeType.EXCEPTION, EdgeDirection.FORWARD)); for (Statement node : setNodes) { setHandlers.retainAll(node.getNeighbours(EdgeType.EXCEPTION, EdgeDirection.FORWARD)); } if (!setHandlers.isEmpty()) { for (StatEdge edge : head.getEdges(EdgeType.EXCEPTION, EdgeDirection.FORWARD)) { Statement handler = edge.getDestination(); if (setHandlers.contains(handler)) { if (!setNodes.containsKey(handler.id)) { stat.addSuccessor(new StatEdge(stat, handler, edge.getExceptions())); } } } for (Statement node : setNodes) { for (StatEdge edge : node.getEdges(EdgeType.EXCEPTION, EdgeDirection.FORWARD)) { if (setHandlers.contains(edge.getDestination())) { node.removeSuccessor(edge); } } } } if (post != null && !stat.getNeighbours(EdgeType.EXCEPTION, EdgeDirection.FORWARD).contains(post)) { // TODO: second condition redundant? stat.addSuccessor(new StatEdge(EdgeType.REGULAR, stat, post)); } // adjust statement collection for (Statement st : setNodes) { stats.removeWithKey(st.id); } stats.addWithKey(stat, stat.id); stat.setAllParent(); stat.setParent(this); stat.buildContinueSet(); // monitorenter and monitorexit stat.buildMonitorFlags(); if (stat.type == StatementType.SWITCH) { // special case switch, sorting leaf nodes ((SwitchStatement)stat).sortEdgesAndNodes(); } }