@Test void nested_try_finally() throws Exception { CFG cfg = buildCFG(" void foo() {\n"+ " try {\n"+ " java.util.zip.ZipFile file = new java.util.zip.ZipFile(fileName);\n"+ " try {\n"+ " file.foo(); " } finally {\n"+ " file.close();\n"+ " }\n"+ " } catch (Exception e) {\n"+ " " }\n"+ " }"); CFGChecker cfgChecker = checker( block( element(Tree.Kind.TRY_STATEMENT) ).successors(5), block( element(Tree.Kind.IDENTIFIER, "fileName"), element(Kind.NEW_CLASS) ).successors(4).exceptions(0,1), block( element(Kind.VARIABLE, "file"), element(Kind.TRY_STATEMENT) ).successors(3), block( element(Tree.Kind.IDENTIFIER, "file"), element(Tree.Kind.METHOD_INVOCATION) ).successors(2).exceptions(2), block( element(Tree.Kind.IDENTIFIER, "file"), element(Tree.Kind.METHOD_INVOCATION) ).successors(0).exceptions(0,1), block( element(Kind.VARIABLE, "e") ) ); 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);  }