diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java index ef38bc843c6..203fcf6ff4f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java @@ -82,9 +82,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation; public class LookupData extends ScopeLookupData { public ICPPTemplateArgument[] fTemplateArguments; public Map> usingDirectives= Collections.emptyMap(); - + /** Used to ensure we don't visit things more than once. */ - public ObjectSet visited= new ObjectSet(1); + public ObjectSet visited= new ObjectSet<>(1); public boolean contentAssist = false; @@ -97,12 +97,12 @@ public class LookupData extends ScopeLookupData { public boolean checkAssociatedScopes= false; public boolean forUsingDeclaration = false; - + /** When computing the cost of a method call, treat the first argument as the implied object. */ public boolean argsContainImpliedObject = false; /** In list-initialization **/ public boolean fNoNarrowing= false; - + private IASTDeclarator fDeclarator; private boolean fFunctionCall; private IType fImpliedObjectType; @@ -113,7 +113,7 @@ public class LookupData extends ScopeLookupData { public ICPPClassType skippedScope; public Object foundItems = null; public ProblemBinding problem; - + public LookupData(IASTName n) { super(n, true, false); if (n == null) @@ -130,12 +130,12 @@ public class LookupData extends ScopeLookupData { fTemplateArguments= args; configureWith(n); } - + public LookupData(char[] name, ICPPTemplateArgument[] templateArgs, IASTNode lookupPoint) { super(name, lookupPoint); fTemplateArguments= templateArgs; } - + public LookupData(char[] name, ICPPTemplateArgument[] templateArgs, IASTTranslationUnit tu) { super(name, tu); fTemplateArguments= templateArgs; @@ -151,7 +151,7 @@ public class LookupData extends ScopeLookupData { if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) { tn= (IASTName) tn.getParent(); } - + IASTNode parent = tn.getParent(); IASTNode nameParent= parent; if (parent instanceof ICPPASTQualifiedName) { @@ -170,10 +170,10 @@ public class LookupData extends ScopeLookupData { } else if (qualifier.length > 0) { if (qualifier[0] != tn) { qualified= true; - } + } } - } - + } + if (nameParent instanceof ICPPASTBaseSpecifier || nameParent instanceof ICPPASTElaboratedTypeSpecifier || nameParent instanceof ICPPASTCompositeTypeSpecifier) { @@ -190,7 +190,7 @@ public class LookupData extends ScopeLookupData { } } } - + /** * Returns whether the name belongs to a simple declaration or function definition. */ @@ -201,19 +201,19 @@ public class LookupData extends ScopeLookupData { if (node instanceof IASTSimpleDeclaration || node instanceof IASTFunctionDefinition) return (IASTDeclaration) node; - + return null; } public IASTDeclarator getDeclarator() { return fDeclarator; } - + public boolean forExplicitFunctionSpecialization() { IASTName n = getLookupName(); if (n == null) return false; - + IASTDeclaration decl= forDeclaration(); if (decl != null) { if (n.getParent() instanceof ICPPASTTemplateId) @@ -233,17 +233,17 @@ public class LookupData extends ScopeLookupData { public boolean isFunctionCall() { return fFunctionCall; } - + public static boolean checkWholeClassScope(IASTName name) { - if (name == null) + if (name == null) return true; - + IASTNode node = name.getParent(); while (node instanceof IASTName) { name= (IASTName) node; node= name.getParent(); } - + final ASTNodeProperty nameProp = name.getPropertyInParent(); if (nameProp == IASTIdExpression.ID_NAME || nameProp == IASTFieldReference.FIELD_NAME || @@ -257,7 +257,7 @@ public class LookupData extends ScopeLookupData { } else { return false; } - + for (; node != null; node= node.getParent()) { // 3.3.7-5 if (node.getParent() instanceof IASTFunctionDefinition) { @@ -275,7 +275,7 @@ public class LookupData extends ScopeLookupData { } // No inline method. return false; - } + } if (node instanceof IASTInitializerList || node instanceof IASTEqualsInitializer) { if (node.getPropertyInParent() == IASTDeclarator.INITIALIZER) { IASTNode decl= node.getParent(); @@ -293,8 +293,8 @@ public class LookupData extends ScopeLookupData { // Not within a class definition return false; } - - if (decl instanceof IASTSimpleDeclaration && + + if (decl instanceof IASTSimpleDeclaration && decl.getPropertyInParent() == IASTCompositeTypeSpecifier.MEMBER_DECLARATION) { // Initializer of non-static data member IASTDeclSpecifier declSpec= ((IASTSimpleDeclaration) decl).getDeclSpecifier(); @@ -302,18 +302,18 @@ public class LookupData extends ScopeLookupData { return true; } // Continue search, we could still be in a method. - } + } } } } return false; } - + public static boolean typesOnly(IASTName tn) { if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) { tn= (IASTName) tn.getParent(); } - + IASTNode parent = tn.getParent(); if (parent instanceof ICPPASTBaseSpecifier || parent instanceof ICPPASTElaboratedTypeSpecifier @@ -323,7 +323,7 @@ public class LookupData extends ScopeLookupData { final ICPPASTQualifiedName qn = (ICPPASTQualifiedName) parent; if (qn.getLastName() != tn) { return true; - } + } } return false; } @@ -331,7 +331,7 @@ public class LookupData extends ScopeLookupData { public boolean hasResultOrProblem() { return problem != null || hasResults(); } - + public boolean hasResults() { if (foundItems == null) return false; @@ -354,7 +354,7 @@ public class LookupData extends ScopeLookupData { } return false; } - + /** * Returns the implied object type, or null. */ @@ -364,7 +364,7 @@ public class LookupData extends ScopeLookupData { } return fImpliedObjectType; } - + /** * Explicitly set the implied object type. * This is for use in cases where implied object type cannot @@ -378,11 +378,11 @@ public class LookupData extends ScopeLookupData { IASTName tn = getLookupName(); if (tn == null) return null; - + if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) { tn= (IASTName) tn.getParent(); } - + IASTNode parent = tn.getParent(); IASTNode nameParent= parent; if (parent instanceof ICPPASTQualifiedName) { @@ -390,8 +390,8 @@ public class LookupData extends ScopeLookupData { if (qn.getLastName() == tn) { nameParent= parent.getParent(); } - } - + } + if (nameParent instanceof IASTFieldReference) { return ((ICPPASTFieldReference) nameParent).getFieldOwnerType(); } else if (nameParent instanceof IASTIdExpression) { @@ -411,11 +411,11 @@ public class LookupData extends ScopeLookupData { IASTName lookupName= getLookupName(); if (lookupName == null) return false; - + IASTNode node = lookupName.getParent(); while (node instanceof IASTName) node = node.getParent(); - + IASTDeclaration decl = null; IASTDeclarator dtor = null; if (node instanceof ICPPASTDeclSpecifier && node.getParent() instanceof IASTDeclaration) { @@ -445,7 +445,7 @@ public class LookupData extends ScopeLookupData { } return false; } - + public boolean checkAssociatedScopes() { return !qualified && fFunctionCall; } @@ -474,7 +474,7 @@ public class LookupData extends ScopeLookupData { } return false; } - + public void setFunctionArguments(boolean containsImpliedObject, ICPPEvaluation... exprs) { argsContainImpliedObject= containsImpliedObject; functionArgs= exprs; @@ -498,7 +498,7 @@ public class LookupData extends ScopeLookupData { } return functionArgTypes; } - + public ValueCategory[] getFunctionArgumentValueCategories() { if (functionArgValueCategories == null) { ICPPEvaluation[] args= functionArgs; @@ -508,7 +508,7 @@ public class LookupData extends ScopeLookupData { final ICPPEvaluation arg = args[i]; functionArgValueCategories[i] = arg.getValueCategory(getLookupPoint()); } - } + } } return functionArgValueCategories; } @@ -519,7 +519,7 @@ public class LookupData extends ScopeLookupData { return 0; } - public int getFunctionArgumentPackExpansionCount() { + public int getFunctionArgumentPackExpansionCount() { int count= 0; if (functionArgs != null) { for (ICPPEvaluation arg : functionArgs) { @@ -537,7 +537,7 @@ public class LookupData extends ScopeLookupData { public IBinding[] getFoundBindings() { if (foundItems instanceof Object[]) { Object[] items = (Object[]) foundItems; - if (items.length != 0) { + if (items.length != 0) { IBinding[] bindings = new IBinding[items.length]; int k = 0; for (Object item : items) { @@ -554,7 +554,7 @@ public class LookupData extends ScopeLookupData { } return IBinding.EMPTY_BINDING_ARRAY; } - + public boolean ignoreRecursionResolvingBindings() { // When name lookup is performed during template instantiation // rather than for an AST name, infinite recursion can sometimes