Skip to content

Commit 9455994

Browse files
mickaelistriaRob Stryker
authored andcommitted
Fix some relevance for member dereference
1 parent 2a18c8c commit 9455994

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2264,6 +2264,7 @@ private CompletionProposal toProposal(IBinding binding, String completion) {
22642264
res.completionEngine = this.nestedEngine;
22652265
res.nameLookup = this.nameEnvironment.nameLookup;
22662266

2267+
boolean isInQualifiedName = this.toComplete.getLocationInParent() == QualifiedName.NAME_PROPERTY || this.toComplete.getLocationInParent() == FieldAccess.NAME_PROPERTY;
22672268
res.setRelevance(CompletionEngine.computeBaseRelevance() +
22682269
CompletionEngine.computeRelevanceForResolution() +
22692270
this.nestedEngine.computeRelevanceForInterestingProposal() +
@@ -2272,7 +2273,7 @@ private CompletionProposal toProposal(IBinding binding, String completion) {
22722273
binding instanceof IMethodBinding methodBinding ? methodBinding.getReturnType() :
22732274
binding instanceof IVariableBinding variableBinding ? variableBinding.getType() :
22742275
this.toComplete.getAST().resolveWellKnownType(Object.class.getName())) +
2275-
(res.getRequiredProposals() != null || inJavadoc ? 0 : computeRelevanceForQualification(false)) +
2276+
(isInQualifiedName || res.getRequiredProposals() != null || inJavadoc ? 0 : computeRelevanceForQualification(false)) +
22762277
CompletionEngine.computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE) + //no access restriction for class field
22772278
((insideQualifiedReference() && !staticOnly() && !Modifier.isStatic(binding.getModifiers())) || (inJavadoc && !res.isConstructor) ? RelevanceConstants.R_NON_STATIC : 0) +
22782279
(!staticOnly() || inheritedValue ? 0 : RelevanceConstants.R_NON_INHERITED) + // TODO: when is this active?

0 commit comments

Comments
 (0)