示例#1
0
 @SuppressWarnings("unchecked")
 public TryStatement newTryCatch(Block tryBlock, CatchClause... clauses) {
   TryStatement tryStmt = ast.newTryStatement();
   tryStmt.setBody(tryBlock);
   tryStmt.catchClauses().addAll(Arrays.asList(clauses));
   return tryStmt;
 }
示例#2
0
 /* (omit javadoc for this method)
  * Method declared on ASTNode.
  */
 ASTNode clone0(AST target) {
   TryStatement result = new TryStatement(target);
   result.setSourceRange(this.getStartPosition(), this.getLength());
   result.copyLeadingComment(this);
   result.setBody((Block) getBody().clone(target));
   result.catchClauses().addAll(ASTNode.copySubtrees(target, catchClauses()));
   result.setFinally((Block) ASTNode.copySubtree(target, getFinally()));
   return result;
 }
示例#3
0
 /* (omit javadoc for this method)
  * Method declared on ASTNode.
  */
 final ASTNode internalGetSetChildProperty(
     ChildPropertyDescriptor property, boolean get, ASTNode child) {
   if (property == BODY_PROPERTY) {
     if (get) {
       return getBody();
     } else {
       setBody((Block) child);
       return null;
     }
   }
   if (property == FINALLY_PROPERTY) {
     if (get) {
       return getFinally();
     } else {
       setFinally((Block) child);
       return null;
     }
   }
   // allow default implementation to flag the error
   return super.internalGetSetChildProperty(property, get, child);
 }
 /**
  * Builds a new {@link TryStatement} instance.
  *
  * @param body the try body
  * @param catchClauses the catch clauses for the try
  * @return a new try statement
  */
 public TryStatement try0(final Block body, CatchClause... catchClauses) {
   final TryStatement tryS = ast.newTryStatement();
   tryS.setBody(body);
   addAll(catchClauses(tryS), catchClauses);
   return tryS;
 }