@Override final boolean internalGetSetBooleanProperty(SimplePropertyDescriptor property, boolean get, boolean value) { if (property == VAR_PROPERTY) { if (get) { return isVar(); } else { if (Long.compare(this.ast.scanner.complianceLevel, ClassFileConstants.JDK10) < 0) { setVar(false); } else { setVar(value); } return false; } } // allow default implementation to flag the error return super.internalGetSetBooleanProperty(property, get, value); }
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; }
@Override ASTNode clone0(AST target) { SimpleName result = new SimpleName(target); result.setSourceRange(getStartPosition(), getLength()); result.setIdentifier(getIdentifier()); if (this.ast.apiLevel >= AST.JLS10_INTERNAL && Long.compare(this.ast.scanner.complianceLevel, 10) >= 0) { result.setVar(isVar()); } return result; }
public static SimpleName[] findByProblems(ASTNode parent, SimpleName nameNode) { if (nameNode.getAST().apiLevel() >= AST.JLS10 && nameNode.isVar()) { return null; if (node instanceof SimpleName && name.equals(((SimpleName) node).getIdentifier())) { if (node instanceof SimpleName && name.equals(((SimpleName) node).getIdentifier())) { if (node.getAST().apiLevel() < AST.JLS10 || !((SimpleName) node).isVar()) res.add((SimpleName) node);
@Override public boolean visit(SimpleName node) { if (node.getAST().apiLevel() >= AST.JLS10 && node.isVar()) { return false; } IBinding binding= node.resolveBinding(); if (binding == null) { return false; } binding= getDeclaration(binding); if (fBinding == binding) { fResult.add(node); } else if (binding.getKind() != fBinding.getKind()) { return false; } else if (binding.getKind() == IBinding.METHOD) { IMethodBinding curr= (IMethodBinding) binding; IMethodBinding methodBinding= (IMethodBinding) fBinding; if (methodBinding.overrides(curr) || curr.overrides(methodBinding)) { fResult.add(node); } } return false; }
@Override public boolean visit(SimpleName node) { boolean isVarType= node.getAST().apiLevel() >= AST.JLS10 && node.isVar(); if (! node.isDeclaration() && isMovedMember(node.resolveBinding()) && ! isVarType && ! isProcessed(node)) rewrite(node, fTarget); return false; }
private static boolean getRenameLocalProposals(IInvocationContext context, ASTNode node, IProblemLocation[] locations, Collection<ICommandAccess> resultingCollections) { if (!(node instanceof SimpleName)) { return false; } SimpleName name= (SimpleName) node; if (name.getAST().apiLevel() >= AST.JLS10 && name.isVar()) { return false; } IBinding binding= name.resolveBinding(); if (binding != null && (binding.getKind() == IBinding.PACKAGE || binding.getKind() == IBinding.MODULE)) { return false; } if (containsQuickFixableRenameLocal(locations)) { return false; } if (resultingCollections == null) { return true; } LinkedNamesAssistProposal proposal= new LinkedNamesAssistProposal(context, name); if (locations.length != 0) { proposal.setRelevance(IProposalRelevance.LINKED_NAMES_ASSIST_ERROR); } resultingCollections.add(proposal); return true; }
@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); }
if (name.getAST().apiLevel() >= AST.JLS10 && name.isVar()) { return false;
private boolean isVarTypeSelection(ITextSelection textSelection) { if (textSelection instanceof JavaTextSelection) { ASTNode node= ((JavaTextSelection) textSelection).resolveCoveringNode(); if (node instanceof SimpleName && node.getAST().apiLevel() >= AST.JLS10 && ((SimpleName) node).isVar()) { return true; } } else if (textSelection != null) { ITypeRoot typeRoot= EditorUtility.getEditorInputJavaElement(fEditor, true); if (typeRoot != null) { IDocument document= JavaUI.getDocumentProvider().getDocument(fEditor.getEditorInput()); if (document != null) { JavaTextSelection javaTextSelection= new JavaTextSelection(typeRoot, document, textSelection.getOffset(), textSelection.getLength()); return isVarTypeSelection(javaTextSelection); } } } return false; } }
return this.getTypeBinding(qualifiedSuperReference.qualification.resolvedType); } else if (node instanceof LocalDeclaration) { return name.getAST().apiLevel() >= AST.JLS10_INTERNAL && name instanceof SimpleName && ((SimpleName) name).isVar() ? resolveTypeBindingForName(name) : this.getVariableBinding(((LocalDeclaration)node).binding);