ASTNode clone0(AST target) { TypeDeclarationStatement result = new TypeDeclarationStatement(target); result.setSourceRange(getStartPosition(), getLength()); result.copyLeadingComment(this); result.setDeclaration( (AbstractTypeDeclaration) getDeclaration().clone(target)); return result; }
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == TYPE_DECLARATION_PROPERTY) { if (get) { return getTypeDeclaration(); } else { setTypeDeclaration((TypeDeclaration) child); return null; } } if (property == DECLARATION_PROPERTY) { if (get) { return getDeclaration(); } else { setDeclaration((AbstractTypeDeclaration) child); return null; } } // allow default implementation to flag the error return super.internalGetSetChildProperty(property, get, child); }
/** * Returns the type declaration of this local type declaration * statement (JLS2 API only). * * @return the type declaration node * @exception UnsupportedOperationException if this operation is used in * an AST later than JLS2 * @deprecated In the JLS3 API, this method is replaced by * {@link #getDeclaration()}, which returns <code>AbstractTypeDeclaration</code> * instead of <code>TypeDeclaration</code>. */ public TypeDeclaration getTypeDeclaration() { return internalGetTypeDeclaration(); }
/** * Internal synonym for deprecated method. Used to avoid * deprecation warnings. * @since 3.1 */ /*package*/ final TypeDeclaration internalGetTypeDeclaration() { supportedOnlyIn2(); return (TypeDeclaration) getDeclaration(); }
/** * Creates a new unparented local type declaration statement node * owned by this AST, for the given type declaration. * <p> * This method can be used to convert a type declaration * (<code>TypeDeclaration</code>) into a statement * (<code>Statement</code>) by wrapping it. * </p> * * @param decl the type declaration * @return a new unparented local type declaration statement node * @exception IllegalArgumentException if: * <ul> * <li>the node belongs to a different AST</li> * <li>the node already has a parent</li> * </ul> */ public TypeDeclarationStatement newTypeDeclarationStatement(TypeDeclaration decl) { TypeDeclarationStatement result = new TypeDeclarationStatement(this); result.setDeclaration(decl); return result; }
TypeDeclarationStatement typeDeclarationStatement = new TypeDeclarationStatement(this.ast); typeDeclarationStatement.setDeclaration(typeDeclaration); switch(this.ast.apiLevel) { case AST.JLS2_INTERNAL : TypeDeclaration typeDecl = typeDeclarationStatement.internalGetTypeDeclaration(); typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength()); break; default : AbstractTypeDeclaration typeDeclAST3 = typeDeclarationStatement.getDeclaration(); typeDeclarationStatement.setSourceRange(typeDeclAST3.getStartPosition(), typeDeclAST3.getLength()); break;
@Override public boolean visit(TypeDeclarationStatement node) { if (node.getAST().apiLevel() >= JLS3) { node.getDeclaration().accept(this); } return false; }
public boolean visit(TypeDeclarationStatement node) { if (node.getAST().apiLevel() == AST.JLS2) { node.getTypeDeclaration().accept(this); } if (node.getAST().apiLevel() >= AST.JLS3) { node.getDeclaration().accept(this); } return false; }
@Override void accept0(ASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { acceptChild(visitor, getDeclaration()); } visitor.endVisit(this); }
@Override int treeSize() { return memSize() + (this.typeDecl == null ? 0 : getDeclaration().treeSize()); } }
/** * Creates a new unparented local type declaration statement node * owned by this AST, for the given type declaration. * <p> * This method can be used to convert any kind of type declaration * (<code>AbstractTypeDeclaration</code>) into a statement * (<code>Statement</code>) by wrapping it. * </p> * * @param decl the type declaration * @return a new unparented local type declaration statement node * @exception IllegalArgumentException if: * <ul> * <li>the node belongs to a different AST</li> * <li>the node already has a parent</li> * </ul> * @since 3.0 */ public TypeDeclarationStatement newTypeDeclarationStatement(AbstractTypeDeclaration decl) { TypeDeclarationStatement result = new TypeDeclarationStatement(this); if (this.apiLevel == AST.JLS2) { result.internalSetTypeDeclaration((TypeDeclaration) decl); } if (this.apiLevel >= AST.JLS3) { result.setDeclaration(decl); } return result; }
/** * The child property stored on the <code>typeDecl</code> instance variable. * In JLS2, corresponds to TYPE_DECLARATION_PROPERTY. After JLS2, corresponds to * DECLARATION_PROPERTY. * * @return the property corresponding to the <code>typeDecl</code> instance variable; * never <code>null</code> */ private ChildPropertyDescriptor typeDeclProperty () { if (getAST().apiLevel() == AST.JLS2_INTERNAL) { return TYPE_DECLARATION_PROPERTY; } else { return DECLARATION_PROPERTY; } }
public boolean visit(TypeDeclarationStatement node) { if (hasFlag(TYPES, fFlags) && node.getStartPosition() + node.getLength() < fPosition) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); return false; } return !fBreak && isInside(node); }
@Override public boolean visit(TypeDeclarationStatement node) { names.add(node.getDeclaration().getName().getIdentifier()); return false; }
@Override public boolean visit(TypeDeclarationStatement node) { if (hasFlag(TYPES, fFlags) && fPosition < node.getStartPosition()) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return false; } }
/** * Internal synonym for {@link TypeDeclarationStatement#getTypeDeclaration()}. Use to alleviate * deprecation warnings. * @deprecated * @since 3.4 */ private static TypeDeclaration getTypeDeclaration(TypeDeclarationStatement node) { return node.getTypeDeclaration(); }
/** * Sets the type declaration of this local type declaration * statement (JLS2 API only). * * @param decl the type declaration node * @exception IllegalArgumentException if: * <ul> * <li>the node belongs to a different AST</li> * <li>the node already has a parent</li> * <li>a cycle in would be created</li> * </ul> * @exception UnsupportedOperationException if this operation is used in * an AST later than JLS2 * @deprecated In the JLS3 API, this method is replaced by * {@link #setDeclaration(AbstractTypeDeclaration)} which takes * <code>AbstractTypeDeclaration</code> instead of * <code>TypeDeclaration</code>. */ public void setTypeDeclaration(TypeDeclaration decl) { internalSetTypeDeclaration(decl); }
TypeDeclarationStatement typeDeclarationStatement = new TypeDeclarationStatement(this.ast); typeDeclarationStatement.setDeclaration(typeDeclaration); switch(this.ast.apiLevel) { case AST.JLS2_INTERNAL : TypeDeclaration typeDecl = typeDeclarationStatement.internalGetTypeDeclaration(); typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength()); break; default : AbstractTypeDeclaration typeDeclAST3 = typeDeclarationStatement.getDeclaration(); typeDeclarationStatement.setSourceRange(typeDeclAST3.getStartPosition(), typeDeclAST3.getLength()); break;
@Override public boolean visit(TypeDeclarationStatement node) { if (node.getAST().apiLevel() >= JLS3) { node.getDeclaration().accept(this); } return false; }
public boolean visit(TypeDeclarationStatement node) { IValue typeDeclaration; if (node.getAST().apiLevel() == AST.JLS2) { typeDeclaration = visitChild(node.getTypeDeclaration()); } else { typeDeclaration = visitChild(node.getDeclaration()); } ownValue = constructStatementNode("declarationStatement", typeDeclaration); return false; }