List of usage examples for org.eclipse.jdt.core.dom Name getParent
public final ASTNode getParent()
null if this is the root node. From source file:ca.mcgill.cs.swevo.ppa.PPAASTUtil.java
License:Open Source License
/** * /* w w w .ja va 2s . c o m*/ * @param name * @return True if this name represents an annotation. */ public static boolean isAnnotation(Name name) { boolean isAnnotation = false; if (name != null) { ASTNode node = name.getParent(); if (node != null && node instanceof Annotation) { isAnnotation = ((Annotation) node).getTypeName().equals(name); } } return isAnnotation; }
From source file:ca.mcgill.cs.swevo.ppa.PPAASTUtil.java
License:Open Source License
/** * //www .j av a 2 s .c o m * @param name * @return The root FQN of a name. */ public static String getFQNFromAnyName(Name name) { String fqn = null; ASTNode node = name; do { Name tempName = (Name) node; fqn = tempName.getFullyQualifiedName(); node = tempName.getParent(); } while (node != null && node instanceof Name); return fqn; }
From source file:ca.mcgill.cs.swevo.ppa.PPAASTUtil.java
License:Open Source License
public static boolean isIndicationOfField(Name node) { boolean isField = false; ASTNode parent = node.getParent(); // The thing here is that if the parent is a qualified name, go one // level up.//from ww w . j ava2s. co m // If the parent is still a qualified name, then, it means we were in // the middle, so this is // not necessarily a field. if (parent instanceof QualifiedName) { QualifiedName qName = (QualifiedName) parent; if (qName.getName().equals(node)) { node = (Name) parent; parent = parent.getParent(); } } if (parent instanceof ArrayAccess) { isField = true; // } else if (parent instanceof ArrayCreation) { // isField = true; } else if (parent instanceof ArrayInitializer) { isField = true; } else if (parent instanceof Assignment) { isField = true; } else if (parent instanceof CastExpression) { CastExpression cExpression = (CastExpression) parent; isField = cExpression.getExpression().equals(node); } else if (parent instanceof ConditionalExpression) { isField = true; } else if (parent instanceof InfixExpression) { isField = true; } else if (parent instanceof WhileStatement) { isField = true; } else if (parent instanceof DoStatement) { isField = true; } else if (parent instanceof ForStatement) { ForStatement forStatement = (ForStatement) parent; isField = forStatement.getExpression().equals(node); } else if (parent instanceof PrefixExpression) { isField = true; } else if (parent instanceof PostfixExpression) { isField = true; } else if (parent instanceof ReturnStatement) { isField = true; } else if (parent instanceof InstanceofExpression) { InstanceofExpression ioe = (InstanceofExpression) parent; isField = ioe.getLeftOperand().equals(node); } else if (parent instanceof FieldAccess) { isField = true; } else if (parent instanceof SuperFieldAccess) { isField = true; } else if (parent instanceof MethodInvocation) { MethodInvocation mi = (MethodInvocation) parent; for (Object object : mi.arguments()) { if (node == object) { isField = true; break; } } } else if (parent instanceof ClassInstanceCreation) { ClassInstanceCreation cic = (ClassInstanceCreation) parent; for (Object object : cic.arguments()) { if (node == object) { isField = true; break; } } } else if (parent instanceof VariableDeclarationFragment) { isField = true; } return isField; }
From source file:com.intel.ide.eclipse.mpt.ast.UnresolvedElementsSubProcessor.java
License:Open Source License
/** * //from w w w. java 2s.c om * @param node The name node in question * @return If it is safe to declare this node as a field, as opposed to a type */ private static boolean isVariableProposalSafe(Name node) { ASTNode parent = node.getParent(); if (parent == null || !(parent instanceof Name)) return true; QualifiedName parentName = (QualifiedName) parent; if (parentName.getQualifier() == node) return false; return isVariableProposalSafe(parentName); }
From source file:com.intel.ide.eclipse.mpt.ast.UnresolvedElementsSubProcessor.java
License:Open Source License
public static void getVariableProposals(IInvocationContext context, IProblemLocation problem, IVariableBinding resolvedField, Map<String, Map> proposals) throws CoreException { ICompilationUnit cu = context.getCompilationUnit(); CompilationUnit astRoot = context.getASTRoot(); ASTNode selectedNode = problem.getCoveredNode(astRoot); if (selectedNode == null) { return;//from w w w.ja v a 2 s . c om } // type that defines the variable ITypeBinding binding = null; ITypeBinding declaringTypeBinding = Bindings.getBindingOfParentTypeContext(selectedNode); if (declaringTypeBinding == null) { return; } // possible type kind of the node boolean suggestVariableProposals = true; while (selectedNode instanceof ParenthesizedExpression) { selectedNode = ((ParenthesizedExpression) selectedNode).getExpression(); } Name node = null; switch (selectedNode.getNodeType()) { case ASTNode.SIMPLE_NAME: node = (SimpleName) selectedNode; if (!isVariableProposalSafe(node)) return; ASTNode parent = node.getParent(); StructuralPropertyDescriptor locationInParent = node.getLocationInParent(); if (locationInParent == MethodInvocation.EXPRESSION_PROPERTY) { } else if (locationInParent == FieldAccess.NAME_PROPERTY) { Expression expression = ((FieldAccess) parent).getExpression(); if (expression != null) { binding = expression.resolveTypeBinding(); if (binding == null) { node = null; } } } else if (parent instanceof SimpleType) { suggestVariableProposals = false; } else if (parent instanceof QualifiedName) { Name qualifier = ((QualifiedName) parent).getQualifier(); if (qualifier != node) { binding = qualifier.resolveTypeBinding(); } else { } ASTNode outerParent = parent.getParent(); while (outerParent instanceof QualifiedName) { outerParent = outerParent.getParent(); } if (outerParent instanceof SimpleType) { suggestVariableProposals = false; } } else if (locationInParent == SwitchCase.EXPRESSION_PROPERTY) { ITypeBinding switchExp = ((SwitchStatement) node.getParent().getParent()).getExpression() .resolveTypeBinding(); if (switchExp != null && switchExp.isEnum()) { binding = switchExp; } } else if (locationInParent == SuperFieldAccess.NAME_PROPERTY) { binding = declaringTypeBinding.getSuperclass(); } break; case ASTNode.QUALIFIED_NAME: QualifiedName qualifierName = (QualifiedName) selectedNode; ITypeBinding qualifierBinding = qualifierName.getQualifier().resolveTypeBinding(); if (qualifierBinding != null) { node = qualifierName.getName(); binding = qualifierBinding; } else { node = qualifierName.getQualifier(); suggestVariableProposals = node.isSimpleName(); } if (selectedNode.getParent() instanceof SimpleType) { suggestVariableProposals = false; } break; case ASTNode.FIELD_ACCESS: FieldAccess access = (FieldAccess) selectedNode; Expression expression = access.getExpression(); if (expression != null) { binding = expression.resolveTypeBinding(); if (binding != null) { node = access.getName(); } } break; case ASTNode.SUPER_FIELD_ACCESS: binding = declaringTypeBinding.getSuperclass(); node = ((SuperFieldAccess) selectedNode).getName(); break; default: } if (node == null) { return; } if (!suggestVariableProposals) { return; } SimpleName simpleName = node.isSimpleName() ? (SimpleName) node : ((QualifiedName) node).getName(); boolean isWriteAccess = ASTResolving.isWriteAccess(node); if (resolvedField == null || binding == null || resolvedField.getDeclaringClass() != binding.getTypeDeclaration() && Modifier.isPrivate(resolvedField.getModifiers())) { // new fields addNewFieldProposals(cu, astRoot, binding, declaringTypeBinding, simpleName, isWriteAccess, proposals); } }
From source file:com.intel.ide.eclipse.mpt.ast.UnresolvedElementsSubProcessor.java
License:Open Source License
public static void getTypeProposals(IInvocationContext context, IProblemLocation problem, Map<String, LinkedCorrectionProposal> proposals) throws CoreException { ICompilationUnit cu = context.getCompilationUnit(); ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return;//from w w w . j ava 2 s. co m } int kind = evauateTypeKind(selectedNode, cu.getJavaProject()); while (selectedNode.getLocationInParent() == QualifiedName.NAME_PROPERTY) { selectedNode = selectedNode.getParent(); } Name node = null; if (selectedNode instanceof SimpleType) { node = ((SimpleType) selectedNode).getName(); } else if (selectedNode instanceof ArrayType) { Type elementType = ((ArrayType) selectedNode).getElementType(); if (elementType.isSimpleType()) { node = ((SimpleType) elementType).getName(); } else { return; } } else if (selectedNode instanceof Name) { node = (Name) selectedNode; } else { return; } while (node.getParent() instanceof QualifiedName) { node = (Name) node.getParent(); } if (selectedNode != node) { kind = evauateTypeKind(node, cu.getJavaProject()); } if ((kind & (SimilarElementsRequestor.CLASSES | SimilarElementsRequestor.INTERFACES)) != 0) { kind &= ~SimilarElementsRequestor.ANNOTATIONS; // only propose annotations when there are no other suggestions } addNewTypeProposals(cu, node, kind, IProposalRelevance.NEW_TYPE, proposals); }
From source file:edu.illinois.jflow.core.transformations.code.ExtractClosureAnalyzer.java
License:Open Source License
@Override public void endVisit(CompilationUnit node) { RefactoringStatus status = getStatus(); superCall: {//from w w w . j av a 2 s. c o m if (status.hasFatalError()) break superCall; if (!hasSelectedNodes()) { ASTNode coveringNode = getLastCoveringNode(); if (coveringNode instanceof Block && coveringNode.getParent() instanceof MethodDeclaration) { MethodDeclaration methodDecl = (MethodDeclaration) coveringNode.getParent(); Message[] messages = ASTNodes.getMessages(methodDecl, ASTNodes.NODE_ONLY); if (messages.length > 0) { status.addFatalError( Messages.format(JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_compile_errors, BasicElementLabels .getJavaElementName(methodDecl.getName().getIdentifier())), JavaStatusContext.create(fCUnit, methodDecl)); break superCall; } } status.addFatalError(JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_only_method_body); break superCall; } fEnclosingBodyDeclaration = (BodyDeclaration) ASTNodes.getParent(getFirstSelectedNode(), BodyDeclaration.class); if (fEnclosingBodyDeclaration == null || (fEnclosingBodyDeclaration.getNodeType() != ASTNode.METHOD_DECLARATION && fEnclosingBodyDeclaration.getNodeType() != ASTNode.FIELD_DECLARATION && fEnclosingBodyDeclaration.getNodeType() != ASTNode.INITIALIZER)) { status.addFatalError(JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_only_method_body); break superCall; } else if (ASTNodes.getEnclosingType(fEnclosingBodyDeclaration) == null) { status.addFatalError( JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_compile_errors_no_parent_binding); break superCall; } else if (fEnclosingBodyDeclaration.getNodeType() == ASTNode.METHOD_DECLARATION) { fEnclosingMethodBinding = ((MethodDeclaration) fEnclosingBodyDeclaration).resolveBinding(); } if (!isSingleExpressionOrStatementSet()) { status.addFatalError(JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_single_expression_or_set); break superCall; } if (isExpressionSelected()) { ASTNode expression = getFirstSelectedNode(); if (expression instanceof Name) { Name name = (Name) expression; if (name.resolveBinding() instanceof ITypeBinding) { status.addFatalError( JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_cannot_extract_type_reference); break superCall; } if (name.resolveBinding() instanceof IMethodBinding) { status.addFatalError( JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_cannot_extract_method_name_reference); break superCall; } if (name.resolveBinding() instanceof IVariableBinding) { StructuralPropertyDescriptor locationInParent = name.getLocationInParent(); if (locationInParent == QualifiedName.NAME_PROPERTY || (locationInParent == FieldAccess.NAME_PROPERTY && !(((FieldAccess) name.getParent()) .getExpression() instanceof ThisExpression))) { status.addFatalError( JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_cannot_extract_part_of_qualified_name); break superCall; } } if (name.isSimpleName() && ((SimpleName) name).isDeclaration()) { status.addFatalError( JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_cannot_extract_name_in_declaration); break superCall; } } fForceStatic = ASTNodes.getParent(expression, ASTNode.SUPER_CONSTRUCTOR_INVOCATION) != null || ASTNodes.getParent(expression, ASTNode.CONSTRUCTOR_INVOCATION) != null; } status.merge(LocalTypeAnalyzer.perform(fEnclosingBodyDeclaration, getSelection())); computeLastStatementSelected(); } super.endVisit(node); }
From source file:org.ebayopensource.dsf.javatojs.translate.NameTranslator.java
License:Open Source License
public JstIdentifier processMtdName(final Name astName, List<IExpr> args, boolean needSuper, boolean needThis, final IExpr qualifierExpr, final BaseJstNode jstNode) { if (astName instanceof SimpleName) { String mtdName = processVarName(astName.toString()); if (jstNode.getOwnerType() instanceof JstType) { // Check imported static methods String typeName = getCtx().getTranslateInfo(jstNode.getRootType()) .getImportedStaticRefTypeName(mtdName); typeName = getCtx().getConfig().getPackageMapping().mapTo(typeName); IJstType refType = getDataTypeTranslator().findJstType(typeName, jstNode); if (refType != null) { JstIdentifier jstIdentifier = new JstIdentifier(mtdName); jstIdentifier.setQualifier(VjoTranslateHelper.getStaticMemberQualifier(refType, jstNode)); IJstMethod mtd = TranslateHelper.Method.getMethod(astName.getParent(), refType, mtdName, args); if (mtd != null) { jstIdentifier.setJstBinding(mtd); jstIdentifier.setType(mtd.getRtnType()); }/*from w w w.ja va 2s .com*/ return jstIdentifier; } } return getMethodIdentifier(astName, args, needSuper, needThis, qualifierExpr, jstNode); } else if (astName instanceof QualifiedName) { QualifiedName qn = (QualifiedName) astName; JstIdentifier qualifier = processMtdName(qn.getQualifier(), args, needSuper, needThis, qualifierExpr, jstNode); JstIdentifier identifier = processMtdName(qn.getName(), args, needSuper, needThis, qualifierExpr, jstNode); if (identifier != null && qualifier != null) { identifier.setQualifier(qualifier); setMtdIdentifierType(identifier, qualifier); } return identifier; } else { getLogger().logUnhandledNode(this, (ASTNode) astName, jstNode); return null; } }
From source file:org.ebayopensource.dsf.javatojs.translate.NameTranslator.java
License:Open Source License
private JstIdentifier getMethodIdentifier(final Name astName, List<IExpr> args, boolean hasSuper, boolean hasThis, final IExpr qualifierExpr, final BaseJstNode jstNode) { String name = processVarName(astName.toString()); VjoConvention convension = getCtx().getConfig().getVjoConvention(); IJstType ownerType = jstNode.getOwnerType(); IJstType scopeType = ownerType;// w w w. jav a2 s . co m if (qualifierExpr != null && qualifierExpr.getResultType() != null) { scopeType = qualifierExpr.getResultType(); } String qualifier = null; IJstMethod jstMtd = null; JstIdentifier jstIdentifier = new JstIdentifier(name); JstIdentifier jstQualifier = null; boolean isMember = false; boolean isInherited = false; boolean isOuters = false; boolean isAnon = ownerType.isAnonymous(); if (hasSuper) { if (scopeType.getExtend() != null) { jstMtd = TranslateHelper.Method.getMethod(astName.getParent(), scopeType.getExtend(), name, args); if (jstMtd != null) { isInherited = true; } } } else { jstMtd = TranslateHelper.Method.getMethod(astName.getParent(), scopeType, name, args); if (jstMtd != null) { if (jstMtd.getOwnerType() == scopeType) { isMember = true; } else { isInherited = true; } } } // Check outer type & its hierarchy if (jstMtd == null) { IJstType outerType = scopeType.getOuterType(); while (outerType != null) { jstMtd = TranslateHelper.Method.getMethod(astName.getParent(), outerType, name, args); if (jstMtd != null) { isOuters = true; break; } outerType = outerType.getOuterType(); } } // Check container type if (isAnon && jstMtd == null) { IJstType containerType = scopeType.getExtend(); //String indent = convension.getThisPrefix(); StringBuffer buf = new StringBuffer(convension.getThisPrefix()); while (containerType != null) { jstMtd = containerType.getStaticMethod(name, true); if (jstMtd == null) { jstMtd = containerType.getInstanceMethod(name, true); } if (jstMtd != null) { jstIdentifier.setJstBinding(jstMtd); if (jstMtd.getModifiers().isStatic()) { jstQualifier = VjoTranslateHelper.getStaticPtyOrMtdQualifier(jstIdentifier, jstNode); } else if (qualifierExpr == null) { jstQualifier = new JstIdentifier(buf.toString()); } if (jstQualifier != null) { jstQualifier.setJstBinding(jstMtd.getOwnerType()); jstQualifier.setType(jstMtd.getOwnerType()); setNameQualifier(jstIdentifier, jstQualifier, jstNode); setMtdIdentifierType(jstIdentifier, scopeType); return jstIdentifier; } } if (containerType.isEmbededType()) { containerType = (IJstType) containerType.getParentNode(); buf.append(convension.getParentInstancePrefix()); } else { break; } } } if (jstMtd != null) { jstIdentifier.setJstBinding(jstMtd); if (needReCalcQualifier(qualifierExpr, jstMtd.isStatic())) { if (isMember) { if (hasThis) { jstQualifier = new JstIdentifier(convension.getThisPrefix()); jstQualifier.setJstBinding(ownerType); jstQualifier.setType(ownerType); } } else if (isInherited) { if (jstMtd.getModifiers().isStatic()) { jstQualifier = VjoTranslateHelper.getStaticPtyOrMtdQualifier(jstIdentifier, jstNode); } else if (qualifierExpr == null) { if (hasSuper) { jstQualifier = new JstIdentifier(convension.getBasePrefix()); } else if (hasThis) { jstQualifier = new JstIdentifier(convension.getThisPrefix()); } } if (jstQualifier != null) { IJstType binding = jstMtd.getOwnerType(); jstQualifier.setJstBinding(binding); jstQualifier.setType(binding); if (binding != null && !ownerType.getRootType().getImportsMap().values().contains(binding)) { getDataTypeTranslator().addImport(binding, (JstType) ownerType, binding.getSimpleName()); } } } else if (isOuters) { if (jstMtd.getModifiers().isStatic()) { jstQualifier = VjoTranslateHelper.getStaticPtyOrMtdQualifier(jstIdentifier, jstNode); } else if (qualifierExpr == null) { jstQualifier = VjoTranslateHelper.getInstanceMemberQualifier(jstMtd.getOwnerType(), jstNode); } if (jstQualifier != null) { jstQualifier.setJstBinding(jstMtd.getOwnerType()); jstQualifier.setType(jstMtd.getOwnerType()); } } if (jstQualifier == null) { jstIdentifier.setJstBinding(jstMtd); if (jstMtd.getOwnerType() == scopeType.getOuterType()) { if (hasThis) { qualifier = convension.getOuterStaticPrefix(); } } else { if (hasSuper) { qualifier = convension.getOuterStaticPrefix() + "." + convension.getBasePrefix(); } } jstQualifier = new JstIdentifier(qualifier); jstQualifier.setJstBinding(jstMtd.getOwnerType()); jstQualifier.setType(jstMtd.getOwnerType()); } setNameQualifier(jstIdentifier, jstQualifier, jstNode); } } setMtdIdentifierType(jstIdentifier, scopeType); if (scopeType instanceof JstType) { TranslateHelper.Method.validateMethodReference(jstMtd, astName, jstNode, this); } return jstIdentifier; }
From source file:org.eclipse.ajdt.internal.ui.editor.quickfix.UnresolvedElementsSubProcessor.java
License:Open Source License
public static void getVariableProposals(IInvocationContext context, IProblemLocation problem, IVariableBinding resolvedField, Collection proposals) throws CoreException { ICompilationUnit cu = context.getCompilationUnit(); CompilationUnit astRoot = context.getASTRoot(); ASTNode selectedNode = problem.getCoveredNode(astRoot); if (selectedNode == null) { return;// w w w . java2 s .c o m } // type that defines the variable ITypeBinding binding = null; ITypeBinding declaringTypeBinding = Bindings.getBindingOfParentTypeContext(selectedNode); if (declaringTypeBinding == null) { return; } // possible type kind of the node boolean suggestVariableProposals = true; int typeKind = 0; while (selectedNode instanceof ParenthesizedExpression) { selectedNode = ((ParenthesizedExpression) selectedNode).getExpression(); } Name node = null; switch (selectedNode.getNodeType()) { case ASTNode.SIMPLE_NAME: node = (SimpleName) selectedNode; ASTNode parent = node.getParent(); StructuralPropertyDescriptor locationInParent = node.getLocationInParent(); if (locationInParent == MethodInvocation.EXPRESSION_PROPERTY) { typeKind = SimilarElementsRequestor.CLASSES; } else if (locationInParent == FieldAccess.NAME_PROPERTY) { Expression expression = ((FieldAccess) parent).getExpression(); if (expression != null) { binding = expression.resolveTypeBinding(); if (binding == null) { node = null; } } } else if (parent instanceof SimpleType) { suggestVariableProposals = false; typeKind = SimilarElementsRequestor.REF_TYPES; } else if (parent instanceof QualifiedName) { Name qualifier = ((QualifiedName) parent).getQualifier(); if (qualifier != node) { binding = qualifier.resolveTypeBinding(); } else { typeKind = SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES; } ASTNode outerParent = parent.getParent(); while (outerParent instanceof QualifiedName) { outerParent = outerParent.getParent(); } if (outerParent instanceof SimpleType) { typeKind = SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES; suggestVariableProposals = false; } } else if (locationInParent == SwitchCase.EXPRESSION_PROPERTY) { ITypeBinding switchExp = ((SwitchStatement) node.getParent().getParent()).getExpression() .resolveTypeBinding(); if (switchExp != null && switchExp.isEnum()) { binding = switchExp; } } else if (locationInParent == SuperFieldAccess.NAME_PROPERTY) { binding = declaringTypeBinding.getSuperclass(); } break; case ASTNode.QUALIFIED_NAME: QualifiedName qualifierName = (QualifiedName) selectedNode; ITypeBinding qualifierBinding = qualifierName.getQualifier().resolveTypeBinding(); if (qualifierBinding != null) { node = qualifierName.getName(); binding = qualifierBinding; } else { node = qualifierName.getQualifier(); typeKind = SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES; suggestVariableProposals = node.isSimpleName(); } if (selectedNode.getParent() instanceof SimpleType) { typeKind = SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES; suggestVariableProposals = false; } break; case ASTNode.FIELD_ACCESS: FieldAccess access = (FieldAccess) selectedNode; Expression expression = access.getExpression(); if (expression != null) { binding = expression.resolveTypeBinding(); if (binding != null) { node = access.getName(); } } break; case ASTNode.SUPER_FIELD_ACCESS: binding = declaringTypeBinding.getSuperclass(); node = ((SuperFieldAccess) selectedNode).getName(); break; default: } if (node == null) { return; } // add type proposals if (typeKind != 0) { if (!JavaModelUtil.is50OrHigher(cu.getJavaProject())) { typeKind = typeKind & ~(SimilarElementsRequestor.ANNOTATIONS | SimilarElementsRequestor.ENUMS | SimilarElementsRequestor.VARIABLES); } int relevance = Character.isUpperCase(ASTNodes.getSimpleNameIdentifier(node).charAt(0)) ? 5 : -2; addSimilarTypeProposals(typeKind, cu, node, relevance + 1, proposals); addNewTypeProposals(cu, node, typeKind, relevance, proposals); } if (!suggestVariableProposals) { return; } SimpleName simpleName = node.isSimpleName() ? (SimpleName) node : ((QualifiedName) node).getName(); boolean isWriteAccess = ASTResolving.isWriteAccess(node); // similar variables addSimilarVariableProposals(cu, astRoot, binding, simpleName, isWriteAccess, proposals); if (resolvedField == null || binding == null || resolvedField.getDeclaringClass() != binding.getTypeDeclaration() && Modifier.isPrivate(resolvedField.getModifiers())) { // new fields addNewFieldProposals(cu, astRoot, binding, declaringTypeBinding, simpleName, isWriteAccess, proposals); // new parameters and local variables if (binding == null) { addNewVariableProposals(cu, node, simpleName, proposals); } } }