コード例 #1
0
 /*
  * @see ASTVisitor#visit(TryStatement)
  */
 @Override
 public boolean visit(TryStatement node) {
   this.fBuffer.append("try "); // $NON-NLS-1$
   if (node.getAST().apiLevel() >= JLS4) {
     if (!node.resources().isEmpty()) {
       this.fBuffer.append("("); // $NON-NLS-1$
       for (Iterator<VariableDeclarationExpression> it = node.resources().iterator();
           it.hasNext(); ) {
         VariableDeclarationExpression var = it.next();
         var.accept(this);
         if (it.hasNext()) {
           this.fBuffer.append(","); // $NON-NLS-1$
         }
       }
       this.fBuffer.append(") "); // $NON-NLS-1$
     }
   }
   node.getBody().accept(this);
   this.fBuffer.append(" "); // $NON-NLS-1$
   for (Iterator<CatchClause> it = node.catchClauses().iterator(); it.hasNext(); ) {
     CatchClause cc = it.next();
     cc.accept(this);
   }
   if (node.getFinally() != null) {
     this.fBuffer.append("finally "); // $NON-NLS-1$
     node.getFinally().accept(this);
   }
   return false;
 }
コード例 #2
0
ファイル: DefinitionVisitor.java プロジェクト: ElliotCP/701A2
 public void visit(TryStmt n, Object arg) {
   n.getTryBlock().accept(this, arg);
   if (n.getCatchs() != null) {
     for (CatchClause c : n.getCatchs()) {
       c.accept(this, arg);
     }
   }
   if (n.getFinallyBlock() != null) {
     n.getFinallyBlock().accept(this, arg);
   }
 }
コード例 #3
0
 @Override
 public void visit(final TryStmt n, final A arg) {
   visitComment(n.getComment(), arg);
   if (n.getResources() != null) {
     for (final VariableDeclarationExpr v : n.getResources()) {
       v.accept(this, 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);
   }
 }