public boolean visit(ConstructorInvocation node) { if (node.getAST().apiLevel() >= JLS3_INTERNAL) { visitList(node, ConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>')); } this.result.append("this("); //$NON-NLS-1$ visitList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, String.valueOf(',')); this.result.append(");"); //$NON-NLS-1$ return false; }
public boolean visit(PrimitiveType node) { if (node.getAST().apiLevel() >= JLS8_INTERNAL) { visitList(node, PrimitiveType.ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } this.result.append(getAttribute(node, PrimitiveType.PRIMITIVE_TYPE_CODE_PROPERTY).toString()); return false; }
private void visitExtraDimensions(ASTNode node, SimplePropertyDescriptor dimensions, ChildListPropertyDescriptor dimensionsInfo) { if (node.getAST().apiLevel() < JLS8_INTERNAL) { int extraDimensions= getIntAttribute(node, dimensions); for (int i = 0; i < extraDimensions; i++) { this.result.append("[]"); //$NON-NLS-1$ } } else { visitList(node, dimensionsInfo, String.valueOf(' '), String.valueOf(' '), Util.EMPTY_STRING); } }
/** * @param decl the method declaration * @return the return type * @deprecated Deprecated to avoid deprecated warnings */ @Deprecated private static ASTNode getReturnType(MethodDeclaration decl) { // used from API, can't eliminate return decl.getAST().apiLevel() == AST.JLS2 ? decl.getReturnType() : decl.getReturnType2(); }
@Override public boolean visit(NameQualifiedType node) { getChildNode(node, NameQualifiedType.QUALIFIER_PROPERTY).accept(this); this.result.append('.'); if (node.getAST().apiLevel() >= JLS8_INTERNAL) { visitList(node, NameQualifiedType.ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, NameQualifiedType.NAME_PROPERTY).accept(this); return false; }
public boolean visit(NameQualifiedType node) { getChildNode(node, NameQualifiedType.QUALIFIER_PROPERTY).accept(this); this.result.append('.'); if (node.getAST().apiLevel() >= JLS8_INTERNAL) { visitList(node, NameQualifiedType.ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, NameQualifiedType.NAME_PROPERTY).accept(this); return false; }
public boolean visit(QualifiedType node) { getChildNode(node, QualifiedType.QUALIFIER_PROPERTY).accept(this); this.result.append('.'); if (node.getAST().apiLevel() >= JLS8_INTERNAL) { visitList(node, QualifiedType.ANNOTATIONS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, QualifiedType.NAME_PROPERTY).accept(this); return false; }
/** * @deprecated Deprecated to avoid deprecated warnings */ private static ASTNode getReturnType(MethodDeclaration decl) { // used from API, can't eliminate return (decl.getAST().apiLevel() == AST.JLS2) ? decl.getReturnType() : decl.getReturnType2(); }
public boolean visit(VariableDeclarationExpression node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { printModifiers(getIntAttribute(node, INTERNAL_VDE_MODIFIERS_PROPERTY), this.result); } else { visitList(node, VariableDeclarationExpression.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } getChildNode(node, VariableDeclarationExpression.TYPE_PROPERTY).accept(this); this.result.append(' '); visitList(node, VariableDeclarationExpression.FRAGMENTS_PROPERTY, String.valueOf(',')); return false; }
private void visitAnnotations(AnnotatableType node) { if (node.getAST().apiLevel() >= AST.JLS8) { doVisitChildren(node.annotations()); } }
private int getDimensions(ArrayType parent) { if (parent.getAST().apiLevel() >= JLS8_INTERNAL) { return ((List) getOriginalValue(parent, ArrayType.DIMENSIONS_PROPERTY)).size(); } Type t = (Type) getOriginalValue(parent, INTERNAL_ARRAY_COMPONENT_TYPE_PROPERTY); int dimensions = 1; // always include this array type while (t.isArrayType()) { dimensions++; t = (Type) getOriginalValue(t, INTERNAL_ARRAY_COMPONENT_TYPE_PROPERTY); } return dimensions; }
private ICompletionProposal getLocalRenameProposal(IInvocationContext context) { ASTNode node= context.getCoveringNode(); if (node instanceof SimpleName) { SimpleName name= (SimpleName) node; if (name.getAST().apiLevel() >= AST.JLS10 && name.isVar()) { return null; } return new LinkedNamesAssistProposal(context, name); } return null; }
@SuppressWarnings("deprecation") private void clearExtraDimensions() { if (getASTNode().getAST().apiLevel() <= 4) { setNodeProperty(variableDeclarationFragment, 0, VariableDeclarationFragment.EXTRA_DIMENSIONS_PROPERTY); } else { setListNodeProperty(variableDeclarationFragment, EMPTY_STRING_ARRAY, EXTRA_DIMENSIONS2_PROPERTY, DIMENSION); } }
public boolean visit(ArrayType node) { if (node.getAST().apiLevel() < AST.JLS8) { getChildNode(node, INTERNAL_ARRAY_COMPONENT_TYPE_PROPERTY).accept(this); this.result.append("[]"); //$NON-NLS-1$ } else { getChildNode(node, ArrayType.ELEMENT_TYPE_PROPERTY).accept(this); visitList(node, ArrayType.DIMENSIONS_PROPERTY, Util.EMPTY_STRING, Util.EMPTY_STRING, Util.EMPTY_STRING); } return false; }
public boolean visit(TypeDeclarationStatement node) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { getChildNode(node, INTERNAL_TDS_TYPE_DECLARATION_PROPERTY).accept(this); } else { getChildNode(node, TypeDeclarationStatement.DECLARATION_PROPERTY).accept(this); } return false; }
public static String asString(ASTNode node) { Assert.isTrue(node.getAST().apiLevel() == IASTSharedValues.SHARED_AST_LEVEL); ASTFlattener flattener= new ASTFlattener(); node.accept(flattener); return flattener.getResult(); }
@Override public boolean visit(SimpleType node) { if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); } if (node.getAST().apiLevel() >= JLS8_INTERNAL) { rewriteTypeAnnotations(node, SimpleType.ANNOTATIONS_PROPERTY, node.getStartPosition()); } rewriteRequiredNode(node, SimpleType.NAME_PROPERTY); return false; }
@SuppressWarnings("deprecation") private void clearExtraDimensions() { if (getASTNode().getAST().apiLevel() <= 4) { setNodeProperty(getASTNode(), 0, MethodDeclaration.EXTRA_DIMENSIONS_PROPERTY); } else { setListNodeProperty(getASTNode(), EMPTY_STRING_ARRAY, EXTRA_DIMENSIONS2_PROPERTY, DIMENSION); } }
@Override public boolean visit(SimpleName node) { if (node.isDeclaration() || isProcessed(node)) return super.visit(node); IBinding binding= node.resolveBinding(); if (isMovedMember(binding)) return super.visit(node); boolean isVarType= node.getAST().apiLevel() >= AST.JLS10 && node.isVar(); if (isSourceAccess(binding) && ! isVarType) rewrite(node, fSource); return super.visit(node); }