@Test void catch_thrown_in_exception() throws Exception { CFG cfg = buildCFG(" void foo() throws MyException {\n"+ " try {\n"+ " try {\n"+ " foo(); \n"+ " } catch (MyException e) {\n"+ " foo(); \n"+ " }\n"+ " } catch (MyException e) {\n"+ " System.out.println(\"outercatch\");\n"+ " }\n"+ " }" + " class MyException extends Exception {}"); CFGChecker checker = checker( block( element(Tree.Kind.TRY_STATEMENT) ).successors(4), block( element(Tree.Kind.TRY_STATEMENT) ).successors(3), block( element(Kind.IDENTIFIER, "foo"), element(Kind.METHOD_INVOCATION) ).successors(0).exceptions(0,2), block( element(Kind.VARIABLE, "e"), element(Kind.IDENTIFIER, "foo"), element(Kind.METHOD_INVOCATION) ).successors(0).exceptions(0, 1), block( element(Kind.VARIABLE, "e"), element(Kind.IDENTIFIER, "System"), element(Kind.MEMBER_SELECT), element(Kind.STRING_LITERAL, "outercatch"), element(Kind.METHOD_INVOCATION) ).successors(0).exceptions(0) ); checker.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);  }