@Test void exit_block_for_finally_with_if_statement() throws Exception { CFG cfg = buildCFG(" void test(boolean fooCalled) {\n" + " Object bar;\n" + " try {\n" + " bar = new Bar();\n" + " } finally {\n" + " if (fooCalled) {foo();\n" + " }\n" + " }\n" + " bar.toString();\n" + " }"); CFGChecker cfgChecker = checker( block( element(Kind.VARIABLE, "bar"), element(Kind.TRY_STATEMENT) ).successors(6), block( element(Kind.NEW_CLASS) ).successors(5).exceptions(4), block( element(Kind.ASSIGNMENT) ).successors(4), block( element(Kind.IDENTIFIER, "fooCalled") ).terminator(Kind.IF_STATEMENT).successors(2, 3), block( element(Kind.IDENTIFIER, "foo"), element(Kind.METHOD_INVOCATION) ).successors(2), new BlockChecker(1, 0).exit(0), block( element(Kind.IDENTIFIER, "bar"), element(Kind.METHOD_INVOCATION) ).successors(0) ); cfgChecker.check(cfg); }
public static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak) { return new CFG(trees, null, ignoreBreak); }
CFG implements ControlFlowGraph { public static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak) { return new CFG(trees, null, ignoreBreak); } }
CFG implements ControlFlowGraph { public static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak) { return new CFG(trees, null, ignoreBreak); } private  CFG(List<? extends Tree> trees, @Nullable Symbol.MethodSymbol symbol, boolean ignoreBreakAndContinue); }
CFG implements ControlFlowGraph { public static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak) { return new CFG(trees, null, ignoreBreak); } private  CFG(List<? extends Tree> trees, @Nullable Symbol.MethodSymbol symbol, boolean ignoreBreakAndContinue); @Override Block exitBlock(); @Nullable Symbol.MethodSymbol methodSymbol(); @Override Block entryBlock(); @Override List<Block> blocks(); List<Block> reversedBlocks(); static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak); static CFG buildCFG(List<? extends Tree> trees); static CFG build(MethodTree tree); void setMethodSymbol(Symbol.MethodSymbol methodSymbol); }
CFG implements ControlFlowGraph { public static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak) { return new CFG(trees, null, ignoreBreak); } private  CFG(List<? extends Tree> trees, @Nullable Symbol.MethodSymbol symbol, boolean ignoreBreakAndContinue); @Override Block exitBlock(); @Nullable Symbol.MethodSymbol methodSymbol(); @Override Block entryBlock(); @Override List<Block> blocks(); List<Block> reversedBlocks(); static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak); static CFG buildCFG(List<? extends Tree> trees); static CFG build(MethodTree tree); void setMethodSymbol(Symbol.MethodSymbol methodSymbol);  }