Skip to content

Commit abb5586

Browse files
committed
Fixes to super completion
Should fix 2 Signed-off-by: David Thompson <[email protected]>
1 parent 632ce9f commit abb5586

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,8 @@ private void statementLikeKeywords() {
34563456
(this.toComplete.getParent() instanceof Assignment)
34573457
||
34583458
(this.toComplete instanceof Assignment)
3459+
||
3460+
(this.toComplete.getParent() instanceof FieldDeclaration)
34593461
;
34603462
if (!isExpressionExpected) {
34613463
keywords.add(Keywords.ASSERT);
@@ -3471,7 +3473,12 @@ private void statementLikeKeywords() {
34713473
keywords.add(Keywords.FINAL);
34723474
keywords.add(Keywords.CLASS);
34733475
}
3474-
keywords.add(Keywords.SUPER);
3476+
if (DOMCompletionUtils.findParent(this.toComplete, new int[] { ASTNode.METHOD_DECLARATION }) instanceof MethodDeclaration md
3477+
&& (md.resolveBinding() == null || !Flags.isStatic(md.resolveBinding().getModifiers()))
3478+
||
3479+
DOMCompletionUtils.findParent(this.toComplete, new int[] { ASTNode.INITIALIZER }) != null){
3480+
keywords.add(Keywords.SUPER);
3481+
}
34753482
keywords.add(Keywords.NEW);
34763483

34773484
{
@@ -3488,8 +3495,7 @@ private void statementLikeKeywords() {
34883495
keywords.add(Keywords.INSTANCEOF);
34893496
}
34903497
}
3491-
3492-
if (!this.expectedTypes.getExpectedTypes().isEmpty()) {
3498+
if (isExpressionExpected) {
34933499
keywords.add(Keywords.NULL);
34943500
}
34953501
if (DOMCompletionUtils.findParent(this.toComplete,

0 commit comments

Comments
 (0)