public static void make(final SingleVariableDeclaration decl, final ModifierKeyword... keywords) { make(decl.getAST(), decl.modifiers(), keywords); }
public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, INTERNAL_VARIABLE_MODIFIERS_PROPERTY), this.result); } else { visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this); if (node.getAST().apiLevel() >= AST.JLS8 && node.isVarargs()) { visitList(node, SingleVariableDeclaration.VARARGS_ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } if (node.getAST().apiLevel() >= JLS3_INTERNAL) { if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) { this.result.append("...");//$NON-NLS-1$ } } this.result.append(' '); getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this); visitExtraDimensions(node, INTERNAL_VARIABLE_EXTRA_DIMENSIONS_PROPERTY, SingleVariableDeclaration.EXTRA_DIMENSIONS2_PROPERTY); ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); initializer.accept(this); } return false; }
@Override public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, INTERNAL_VARIABLE_MODIFIERS_PROPERTY), this.result); } else { visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this); if (node.getAST().apiLevel() >= JLS8_INTERNAL && node.isVarargs()) { visitList(node, SingleVariableDeclaration.VARARGS_ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } if (node.getAST().apiLevel() >= JLS3_INTERNAL) { if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) { this.result.append("...");//$NON-NLS-1$ } } this.result.append(' '); getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this); visitExtraDimensions(node, INTERNAL_VARIABLE_EXTRA_DIMENSIONS_PROPERTY, SingleVariableDeclaration.EXTRA_DIMENSIONS2_PROPERTY); ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); initializer.accept(this); } return false; }
public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, INTERNAL_VARIABLE_MODIFIERS_PROPERTY), this.result); } else { visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this); if (node.getAST().apiLevel() >= AST.JLS8 && node.isVarargs()) { visitList(node, SingleVariableDeclaration.VARARGS_ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } if (node.getAST().apiLevel() >= JLS3_INTERNAL) { if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) { this.result.append("...");//$NON-NLS-1$ } } this.result.append(' '); getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this); visitExtraDimensions(node, INTERNAL_VARIABLE_EXTRA_DIMENSIONS_PROPERTY, SingleVariableDeclaration.EXTRA_DIMENSIONS2_PROPERTY); ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); initializer.accept(this); } return false; }
public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, INTERNAL_VARIABLE_MODIFIERS_PROPERTY), this.result); } else { visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this); if (node.getAST().apiLevel() >= JLS8_INTERNAL && node.isVarargs()) { visitList(node, SingleVariableDeclaration.VARARGS_ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } if (node.getAST().apiLevel() >= JLS3_INTERNAL) { if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) { this.result.append("...");//$NON-NLS-1$ } } this.result.append(' '); getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this); visitExtraDimensions(node, INTERNAL_VARIABLE_EXTRA_DIMENSIONS_PROPERTY, SingleVariableDeclaration.EXTRA_DIMENSIONS2_PROPERTY); ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); initializer.accept(this); } return false; }
public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, INTERNAL_VARIABLE_MODIFIERS_PROPERTY), this.result); } else { visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this); if (node.getAST().apiLevel() >= AST.JLS8 && node.isVarargs()) { visitList(node, SingleVariableDeclaration.VARARGS_ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } if (node.getAST().apiLevel() >= JLS3_INTERNAL) { if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) { this.result.append("...");//$NON-NLS-1$ } } this.result.append(' '); getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this); visitExtraDimensions(node, INTERNAL_VARIABLE_EXTRA_DIMENSIONS_PROPERTY, SingleVariableDeclaration.EXTRA_DIMENSIONS2_PROPERTY); ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); initializer.accept(this); } return false; }
@Override public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { if (node.getAST().apiLevel() >= JLS8) { this.fBuffer.append(' '); List<Annotation> annotations= node.varargsAnnotations(); if (node.getAST().apiLevel() >= JLS8) { List<Dimension> dimensions = node.extraDimensions(); for (Iterator<Dimension> it= dimensions.iterator(); it.hasNext(); ) {
public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, SingleVariableDeclaration.MODIFIERS_PROPERTY), this.result); } else { visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this); if (node.getAST().apiLevel() >= AST.JLS3) { if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) { this.result.append("...");//$NON-NLS-1$ } } this.result.append(' '); getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this); int extraDimensions= getIntAttribute(node, SingleVariableDeclaration.EXTRA_DIMENSIONS_PROPERTY); for (int i = 0; i < extraDimensions; i++) { this.result.append("[]"); //$NON-NLS-1$ } ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); initializer.accept(this); } return false; }
public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() == AST.JLS2) { printModifiers(node.getModifiers()); } if (node.getAST().apiLevel() >= AST.JLS3) { printModifiers(node.modifiers()); } node.getType().accept(this); if (node.getAST().apiLevel() >= AST.JLS3) { if (node.isVarargs()) { this.fBuffer.append("...");//$NON-NLS-1$ } } this.fBuffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); for (int i= 0; i < node.getExtraDimensions(); i++) { this.fBuffer.append("[]"); //$NON-NLS-1$ } if (node.getInitializer() != null) { this.fBuffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); } return false; }
public boolean visit(SingleVariableDeclaration node) { printIndent(); if (node.getAST().apiLevel() == JLS2) { printModifiers(node.getModifiers()); if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { if (node.getAST().apiLevel() >= JLS8) { List annotations = node.varargsAnnotations(); if (annotations.size() > 0) { node.getName().accept(this); int size = node.getExtraDimensions(); if (node.getAST().apiLevel() >= JLS8) { List dimensions = node.extraDimensions(); for (int i = 0; i < size; i++) {
public boolean visit(SingleVariableDeclaration node) { printIndent(); if (node.getAST().apiLevel() == JLS2) { printModifiers(node.getModifiers()); } if (node.getAST().apiLevel() >= AST.JLS3) { printModifiers(node.modifiers()); } node.getType().accept(this); if (node.getAST().apiLevel() >= AST.JLS3) { if (node.isVarargs()) { this.buffer.append("...");//$NON-NLS-1$ } } this.buffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); for (int i = 0; i < node.getExtraDimensions(); i++) { this.buffer.append("[]"); //$NON-NLS-1$ } if (node.getInitializer() != null) { this.buffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); } return false; }
public boolean visit(SingleVariableDeclaration node) { printIndent(); if (node.getAST().apiLevel() == JLS2) { printModifiers(node.getModifiers()); if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { if (node.getAST().apiLevel() >= AST.JLS8) { List annotations = node.varargsAnnotations(); if (annotations.size() > 0) { node.getName().accept(this); int size = node.getExtraDimensions(); if (node.getAST().apiLevel() >= AST.JLS8) { List dimensions = node.extraDimensions(); for (int i = 0; i < size; i++) {
@Override public boolean visit(SingleVariableDeclaration node) { AST ast = node.getAST(); if (node.getExtraDimensions() > 0) { Type type = (Type) ASTNode.copySubtree(ast, node.getType()); for (int i = node.getExtraDimensions(); i > 0; i--) { type = ast.newArrayType(type); } node.setType(type); node.setExtraDimensions(0); } return true; } }
public boolean visit(SingleVariableDeclaration node) { IValue name = values.string(node.getName().getFullyQualifiedName()); IValueList extendedModifiers = parseExtendedModifiers(node.modifiers()); IValue type = visitChild(node.getType()); IValue initializer = node.getInitializer() == null ? null : visitChild(node.getInitializer()); ownValue = constructDeclarationNode("parameter", type, name, values.integer(node.getExtraDimensions()), initializer); if (node.getAST().apiLevel() >= AST.JLS3 && node.isVarargs()) ownValue = constructDeclarationNode("vararg", type, name); setKeywordParameters("modifiers", extendedModifiers); return false; }
protected static SingleVariableDeclaration createPlaceholderForSingleVariableDeclaration(final SingleVariableDeclaration declaration, final ICompilationUnit declaringCu, final TypeVariableMaplet[] mapping, final ASTRewrite rewrite) throws JavaModelException { SingleVariableDeclaration result= null; try { final IDocument document= new Document(declaringCu.getBuffer().getContents()); final ASTRewrite rewriter= ASTRewrite.create(declaration.getAST()); final ITrackedNodePosition position= rewriter.track(declaration); declaration.accept(new TypeVariableMapper(rewriter, mapping)); rewriter.rewriteAST(document, declaringCu.getJavaProject().getOptions(true)).apply(document, TextEdit.NONE); result= (SingleVariableDeclaration) rewrite.createStringPlaceholder(document.get(position.getStartPosition(), position.getLength()), ASTNode.SINGLE_VARIABLE_DECLARATION); } catch (MalformedTreeException exception) { JavaPlugin.log(exception); } catch (BadLocationException exception) { JavaPlugin.log(exception); } return result; }
protected static SingleVariableDeclaration createPlaceholderForSingleVariableDeclaration(final SingleVariableDeclaration declaration, final ICompilationUnit declaringCu, final TypeVariableMaplet[] mapping, final ASTRewrite rewrite) throws JavaModelException { SingleVariableDeclaration result= null; try { final IDocument document= new Document(declaringCu.getBuffer().getContents()); final ASTRewrite rewriter= ASTRewrite.create(declaration.getAST()); final ITrackedNodePosition position= rewriter.track(declaration); declaration.accept(new TypeVariableMapper(rewriter, mapping)); rewriter.rewriteAST(document, declaringCu.getJavaProject().getOptions(true)).apply(document, TextEdit.NONE); result= (SingleVariableDeclaration) rewrite.createStringPlaceholder(document.get(position.getStartPosition(), position.getLength()), ASTNode.SINGLE_VARIABLE_DECLARATION); } catch (MalformedTreeException exception) { JavaPlugin.log(exception); } catch (BadLocationException exception) { JavaPlugin.log(exception); } return result; }
protected static SingleVariableDeclaration createPlaceholderForSingleVariableDeclaration(final SingleVariableDeclaration declaration, final ICompilationUnit declaringCu, final TypeVariableMaplet[] mapping, final ASTRewrite rewrite) throws JavaModelException { SingleVariableDeclaration result= null; try { final IDocument document= new Document(declaringCu.getBuffer().getContents()); final ASTRewrite rewriter= ASTRewrite.create(declaration.getAST()); final ITrackedNodePosition position= rewriter.track(declaration); declaration.accept(new TypeVariableMapper(rewriter, mapping)); rewriter.rewriteAST(document, declaringCu.getJavaProject().getOptions(true)).apply(document, TextEdit.NONE); result= (SingleVariableDeclaration) rewrite.createStringPlaceholder(document.get(position.getStartPosition(), position.getLength()), ASTNode.SINGLE_VARIABLE_DECLARATION); } catch (MalformedTreeException exception) { JavaPlugin.log(exception); } catch (BadLocationException exception) { JavaPlugin.log(exception); } return result; }
int level = node.getAST().apiLevel; return (level >= AST.JLS3_INTERNAL ? safeSubtreeListMatch(node.modifiers(), o.modifiers())
int level = node.getAST().apiLevel; return (level >= AST.JLS3_INTERNAL ? safeSubtreeListMatch(node.modifiers(), o.modifiers())
int level = node.getAST().apiLevel; return (level >= AST.JLS3_INTERNAL ? safeSubtreeListMatch(node.modifiers(), o.modifiers())