@Override public Node visit(final TryStmt n, final A arg) { n.setTryBlock((BlockStmt) n.getTryBlock().accept(this, arg)); final List<CatchClause> catchs = n.getCatchs(); if (catchs != null) { for (int i = 0; i < catchs.size(); i++) { catchs.set(i, (CatchClause) catchs.get(i).accept(this, arg)); } removeNulls(catchs); } if (n.getFinallyBlock() != null) { n.setFinallyBlock((BlockStmt) n.getFinallyBlock().accept(this, arg)); } return n; }
@Override public Boolean visit(final TryStmt n1, final Node arg) { final TryStmt n2 = (TryStmt) arg; if (!nodeEquals(n1.getTryBlock(), n2.getTryBlock())) { return Boolean.FALSE; } if (!nodesEquals(n1.getCatchs(), n2.getCatchs())) { return Boolean.FALSE; } if (!nodeEquals(n1.getFinallyBlock(), n2.getFinallyBlock())) { return Boolean.FALSE; } return Boolean.TRUE; }
@Override public void visit(final TryStmt n, final A arg) { visitComment(n.getComment(), arg); n.getTryBlock().accept(this, arg); if (n.getCatchs() != null) { for (final CatchClause c : n.getCatchs()) { c.accept(this, arg); } } if (n.getFinallyBlock() != null) { n.getFinallyBlock().accept(this, arg); } }
public void visit(TryStmt n, Object arg) { printer.print("try "); n.getTryBlock().accept(this, arg); if (n.getCatchs() != null) { for (CatchClause c : n.getCatchs()) { c.accept(this, arg); } } if (n.getFinallyBlock() != null) { printer.print(" finally "); n.getFinallyBlock().accept(this, arg); } }
@Override public R visit(final TryStmt n, final A arg) { { R result = n.getTryBlock().accept(this, arg); if (result != null) { return result; } } if (n.getCatchs() != null) { for (final CatchClause c : n.getCatchs()) { { R result = c.accept(this, arg); if (result != null) { return result; } } } } if (n.getFinallyBlock() != null) { { R result = n.getFinallyBlock().accept(this, arg); if (result != null) { return result; } } } return null; }
if (n.getFinallyBlock() != null) { printer.print(" finally "); n.getFinallyBlock().accept(this, arg);
@Override public Node visit(TryStmt _n, Object _arg) { List<VariableDeclarationExpr> resources = visit(_n.getResources(),_arg); BlockStmt tryBlock = cloneNodes(_n.getTryBlock(), _arg); List<CatchClause> catchs = visit(_n.getCatchs(), _arg); BlockStmt finallyBlock = cloneNodes(_n.getFinallyBlock(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); TryStmt r = new TryStmt( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), resources, tryBlock, catchs, finallyBlock ); r.setComment(comment); return r; }