Skip to content

Commit c327e20

Browse files
datho7561mickaelistria
authored andcommitted
Fix completion and relevance for super field
- Do not suggest methods from enclosing types after `super.|` - These completions should count as NON_STATIC - These completion should not count as either QUALIFIED or UNQUALIFIED Fixes 1 case Signed-off-by: David Thompson <[email protected]>
1 parent cd5703c commit c327e20

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,7 @@ public Stream<CompletionProposal> toProposals(boolean expectedOnly) {
339339
.filter(binding -> !assistOptions.checkDeprecation || !isDeprecated(binding.getJavaElement()))
340340
.flatMap(binding -> {
341341
if (binding instanceof IMethodBinding methodBinding
342-
&& !(DOMCompletionEngine.this.toComplete.getParent() instanceof QualifiedName)
343-
&& !(DOMCompletionEngine.this.toComplete.getParent() instanceof MethodInvocation)
344-
&& !(DOMCompletionEngine.this.toComplete.getParent() instanceof FieldAccess)) {
342+
&& !DOMCompletionUtils.isInQualifiedName(DOMCompletionEngine.this.toComplete)) {
345343
// Handle referencing methods from parent classes using ClassName.this.methodName()
346344
// Note that the completion text is correct,
347345
// but due to bugs in jdt.ui this completion doesn't work in practice

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/codeassist/DOMCompletionUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.eclipse.jdt.core.dom.Name;
4040
import org.eclipse.jdt.core.dom.PrefixExpression;
4141
import org.eclipse.jdt.core.dom.QualifiedName;
42+
import org.eclipse.jdt.core.dom.SuperFieldAccess;
4243
import org.eclipse.jdt.core.dom.SuperMethodReference;
4344
import org.eclipse.jdt.core.dom.TypeMethodReference;
4445
import org.eclipse.jdt.core.dom.TypePattern;
@@ -214,10 +215,12 @@ public static boolean isInQualifiedName(ASTNode node) {
214215
FieldAccess.NAME_PROPERTY,
215216
ExpressionMethodReference.NAME_PROPERTY,
216217
TypeMethodReference.NAME_PROPERTY,
217-
SuperMethodReference.NAME_PROPERTY).contains(node.getLocationInParent())
218+
SuperMethodReference.NAME_PROPERTY,
219+
SuperFieldAccess.NAME_PROPERTY).contains(node.getLocationInParent())
218220
|| node instanceof FieldAccess
219221
|| node instanceof QualifiedName
220222
|| node instanceof SuperMethodReference
223+
|| node instanceof SuperFieldAccess
221224
|| node instanceof TypeMethodReference;
222225
}
223226

0 commit comments

Comments
 (0)