diff options
author | Vikas Chandra | 2018-03-12 08:31:39 +0000 |
---|---|---|
committer | Vikas Chandra | 2018-04-18 08:03:42 +0000 |
commit | ee7589441b1c0b24e13063921c3a2241305813d2 (patch) | |
tree | 18002d88bcbf4750f2bf22480cd593f7689acf9a | |
parent | ad0d5ebe1c4cbc56434942c80d09ee2a70517c8a (diff) | |
download | eclipse.jdt.core-ee7589441b1c0b24e13063921c3a2241305813d2.tar.gz eclipse.jdt.core-ee7589441b1c0b24e13063921c3a2241305813d2.tar.xz eclipse.jdt.core-ee7589441b1c0b24e13063921c3a2241305813d2.zip |
Bug 491892 - [1.8][content assist] Keyword 'super' not proposed I20180420-2000I20180419-2000
Change-Id: I0ce88dcd9ad1e269bd7da3cf0880ac16c69995a0
Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
3 files changed, 7 insertions, 24 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java index e3826225d6..c1c8fe0bbf 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11449,6 +11449,7 @@ public void testCompletionKeywordThis15() throws JavaModelException { assertResults( "CompletionKeywordThis15.InnerClass[TYPE_REF]{InnerClass, , LCompletionKeywordThis15$InnerClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n"+ + "super[KEYWORD]{super, null, null, super, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) +"}\n"+ "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } @@ -19283,6 +19284,7 @@ public void testStaticMembers1() throws JavaModelException { "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + "staticField[FIELD_REF]{staticField, Ltest.StaticMembers;, I, staticField, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + "staticMethod[METHOD_REF]{staticMethod(), Ltest.StaticMembers;, ()I, staticMethod, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "super[KEYWORD]{super, null, null, super, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } @@ -22063,6 +22065,7 @@ public void test325481b() throws JavaModelException { "element:REFERENCE_ATTRIBUTE completion:REFERENCE_ATTRIBUTE relevance:" + relevance +"\n" + "element:WORK_ATTRIBUTE completion:WORK_ATTRIBUTE relevance:" + relevance +"\n" + "element:class completion:class relevance:" + relevance +"\n" + + "element:super completion:super relevance:" + relevance + "\n" + "element:this completion:this relevance:" + relevance, requestor.getResults()); } finally { diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java index b0fdf5a7b5..991b942660 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java @@ -239,6 +239,7 @@ public void test007() throws JavaModelException { assertResults( "class[FIELD_REF]{class, null, Ljava.lang.Class<LX;>;, class, null, " + (R_DEFAULT + 21) + "}\n" + "f[FIELD_REF]{f, LX;, LFoo;, f, null, " + (R_DEFAULT + 21) + "}\n" + + "super[KEYWORD]{super, null, null, super, null, " + (R_DEFAULT + 21) + "}\n" + "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + 21) + "}\n" + "x1[FIELD_REF]{x1, LX;, I, x1, null, " + (R_DEFAULT + 51) + "}", requestor.getResults()); diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java index b02403efc8..651cb61115 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java @@ -9766,30 +9766,9 @@ public final class CompletionEngine !this.requestor.isIgnored(CompletionProposal.KEYWORD) && ((scope instanceof MethodScope && !((MethodScope)scope).isStatic) || ((methodScope = scope.enclosingMethodScope()) != null && !methodScope.isStatic))) { - if (token.length > 0) { + if (token.length >= 0) { findKeywords(token, new char[][]{Keywords.THIS, Keywords.SUPER}, true, false); - } else { - int relevance = computeBaseRelevance(); - relevance += computeRelevanceForResolution(); - relevance += computeRelevanceForInterestingProposal(); - relevance += computeRelevanceForCaseMatching(this.completionToken, Keywords.THIS); - relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywords - relevance += R_NON_INHERITED; - - this.noProposal = false; - if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { - InternalCompletionProposal proposal = createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition); - proposal.setName(Keywords.THIS); - proposal.setCompletion(Keywords.THIS); - proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); - proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); - proposal.setRelevance(relevance); - this.requestor.accept(proposal); - if (DEBUG) { - this.printDebug(proposal); - } - } - } + } } if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { |