/** * Creates an unparented single variable declaration node owned by this AST. * By default, the declaration is for a variable with an unspecified, but * legal, name and type; no modifiers; no array dimensions after the * variable; no initializer; not variable arity. * * @return a new unparented single variable declaration node */ public SingleVariableDeclaration newSingleVariableDeclaration() { SingleVariableDeclaration result = new SingleVariableDeclaration(this); return result; }
/** * Creates an unparented single variable declaration node owned by this AST. * By default, the declaration is for a variable with an unspecified, but * legal, name and type; no modifiers; no array dimensions after the * variable; no initializer; not variable arity. * * @return a new unparented single variable declaration node */ public SingleVariableDeclaration newSingleVariableDeclaration() { SingleVariableDeclaration result = new SingleVariableDeclaration(this); return result; }
/** * Creates an unparented single variable declaration node owned by this AST. * By default, the declaration is for a variable with an unspecified, but * legal, name and type; no modifiers; no array dimensions after the * variable; no initializer; not variable arity. * * @return a new unparented single variable declaration node */ public SingleVariableDeclaration newSingleVariableDeclaration() { SingleVariableDeclaration result = new SingleVariableDeclaration(this); return result; }
/** * Creates an unparented single variable declaration node owned by this AST. * By default, the declaration is for a variable with an unspecified, but * legal, name and type; no modifiers; no array dimensions after the * variable; no initializer; not variable arity. * * @return a new unparented single variable declaration node */ public SingleVariableDeclaration newSingleVariableDeclaration() { SingleVariableDeclaration result = new SingleVariableDeclaration(this); return result; }
/** * Creates an unparented single variable declaration node owned by this AST. * By default, the declaration is for a variable with an unspecified, but * legal, name and type; no modifiers; no array dimensions after the * variable; no initializer; not variable arity. * * @return a new unparented single variable declaration node */ public SingleVariableDeclaration newSingleVariableDeclaration() { SingleVariableDeclaration result = new SingleVariableDeclaration(this); return result; }
/** * Creates an unparented single variable declaration node owned by this AST. * By default, the declaration is for a variable with an unspecified, but * legal, name and type; no modifiers; no array dimensions after the * variable; no initializer; not variable arity. * * @return a new unparented single variable declaration node */ public SingleVariableDeclaration newSingleVariableDeclaration() { SingleVariableDeclaration result = new SingleVariableDeclaration(this); return result; }
/** * Returns the exception variable declaration of this catch clause. * * @return the exception variable declaration node */ public SingleVariableDeclaration getException() { if (this.exceptionDecl == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.exceptionDecl == null) { preLazyInit(); this.exceptionDecl = new SingleVariableDeclaration(this.ast); postLazyInit(this.exceptionDecl, EXCEPTION_PROPERTY); } } } return this.exceptionDecl; }
/** * Returns the exception variable declaration of this catch clause. * * @return the exception variable declaration node */ public SingleVariableDeclaration getException() { if (this.exceptionDecl == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.exceptionDecl == null) { preLazyInit(); this.exceptionDecl = new SingleVariableDeclaration(this.ast); postLazyInit(this.exceptionDecl, EXCEPTION_PROPERTY); } } } return this.exceptionDecl; }
/** * Returns the exception variable declaration of this catch clause. * * @return the exception variable declaration node */ public SingleVariableDeclaration getException() { if (this.exceptionDecl == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.exceptionDecl == null) { preLazyInit(); this.exceptionDecl = new SingleVariableDeclaration(this.ast); postLazyInit(this.exceptionDecl, EXCEPTION_PROPERTY); } } } return this.exceptionDecl; }
/** * Returns the exception variable declaration of this catch clause. * * @return the exception variable declaration node */ public SingleVariableDeclaration getException() { if (this.exceptionDecl == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.exceptionDecl == null) { preLazyInit(); this.exceptionDecl = new SingleVariableDeclaration(this.ast); postLazyInit(this.exceptionDecl, EXCEPTION_PROPERTY); } } } return this.exceptionDecl; }
/** * Returns the exception variable declaration of this catch clause. * * @return the exception variable declaration node */ public SingleVariableDeclaration getException() { if (this.exceptionDecl == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.exceptionDecl == null) { preLazyInit(); this.exceptionDecl = new SingleVariableDeclaration(this.ast); postLazyInit(this.exceptionDecl, EXCEPTION_PROPERTY); } } } return this.exceptionDecl; }
/** * Returns the exception variable declaration of this catch clause. * * @return the exception variable declaration node */ public SingleVariableDeclaration getException() { if (this.exceptionDecl == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.exceptionDecl == null) { preLazyInit(); this.exceptionDecl = new SingleVariableDeclaration(this.ast); postLazyInit(this.exceptionDecl, EXCEPTION_PROPERTY); } } } return this.exceptionDecl; }
protected SingleVariableDeclaration convertToSingleVariableDeclaration(LocalDeclaration localDeclaration) { final SingleVariableDeclaration variableDecl = new SingleVariableDeclaration(this.ast); setModifiers(variableDecl, localDeclaration); final SimpleName name = new SimpleName(this.ast); name.internalSetIdentifier(new String(localDeclaration.name)); int start = localDeclaration.sourceStart; int nameEnd = localDeclaration.sourceEnd; name.setSourceRange(start, nameEnd - start + 1); variableDecl.setName(name); final int extraDimensions = retrieveExtraDimension(nameEnd + 1, localDeclaration.type.sourceEnd); variableDecl.setExtraDimensions(extraDimensions); Type type = convertType(localDeclaration.type); int typeEnd = type.getStartPosition() + type.getLength() - 1; int rightEnd = Math.max(typeEnd, localDeclaration.declarationSourceEnd); /* * There is extra work to do to set the proper type positions * See PR http://bugs.eclipse.org/bugs/show_bug.cgi?id=23284 */ setTypeForSingleVariableDeclaration(variableDecl, type, extraDimensions); variableDecl.setSourceRange(localDeclaration.declarationSourceStart, rightEnd - localDeclaration.declarationSourceStart + 1); if (this.resolveBindings) { recordNodes(name, localDeclaration); recordNodes(variableDecl, localDeclaration); variableDecl.resolveBinding(); } return variableDecl; }
protected SingleVariableDeclaration convertToSingleVariableDeclaration(LocalDeclaration localDeclaration) { final SingleVariableDeclaration variableDecl = new SingleVariableDeclaration(this.ast); setModifiers(variableDecl, localDeclaration); final SimpleName name = new SimpleName(this.ast);
ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); if (this.ast.apiLevel >= AST.JLS8_INTERNAL) { result.varargsAnnotations().addAll( ASTNode.copySubtrees(target, varargsAnnotations())); } result.setName((SimpleName) getName().clone(target)); if (this.ast.apiLevel >= AST.JLS8_INTERNAL) { result.extraDimensions().addAll( ASTNode.copySubtrees(target, this.extraDimensions())); } else { result.internalSetExtraDimensions(getExtraDimensions()); } result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }
@Override ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); if (this.ast.apiLevel >= AST.JLS8_INTERNAL) { result.varargsAnnotations().addAll( ASTNode.copySubtrees(target, varargsAnnotations())); } result.setName((SimpleName) getName().clone(target)); if (this.ast.apiLevel >= AST.JLS8_INTERNAL) { result.extraDimensions().addAll( ASTNode.copySubtrees(target, this.extraDimensions())); } else { result.internalSetExtraDimensions(getExtraDimensions()); } result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }
ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); if (this.ast.apiLevel >= AST.JLS8) { result.varargsAnnotations().addAll( ASTNode.copySubtrees(target, varargsAnnotations())); } result.setName((SimpleName) getName().clone(target)); if (this.ast.apiLevel >= AST.JLS8) { result.extraDimensions().addAll( ASTNode.copySubtrees(target, this.extraDimensions())); } else { result.internalSetExtraDimensions(getExtraDimensions()); } result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }
ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); if (this.ast.apiLevel >= AST.JLS8) { result.varargsAnnotations().addAll( ASTNode.copySubtrees(target, varargsAnnotations())); } result.setName((SimpleName) getName().clone(target)); if (this.ast.apiLevel >= AST.JLS8) { result.extraDimensions().addAll( ASTNode.copySubtrees(target, this.extraDimensions())); } else { result.internalSetExtraDimensions(getExtraDimensions()); } result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }
ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); if (this.ast.apiLevel >= AST.JLS8) { result.varargsAnnotations().addAll( ASTNode.copySubtrees(target, varargsAnnotations())); } result.setName((SimpleName) getName().clone(target)); if (this.ast.apiLevel >= AST.JLS8) { result.extraDimensions().addAll( ASTNode.copySubtrees(target, this.extraDimensions())); } else { result.internalSetExtraDimensions(getExtraDimensions()); } result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }
ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); result.setExtraDimensions(getExtraDimensions()); result.setName((SimpleName) getName().clone(target)); result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }