Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGayan Perera2017-11-20 15:02:47 +0000
committerTill Brychcy2017-11-22 17:53:54 +0000
commitd9bc7897f13a47cf70b0edfdef55bb3d99dfc9d8 (patch)
tree8a64e48d2cf82e2941887c35c1af938d477cc8b5
parent903cb9c98a1ec2c69c07c48f4b0ff0c985569d89 (diff)
downloadeclipse.jdt.core-d9bc7897f13a47cf70b0edfdef55bb3d99dfc9d8.tar.gz
eclipse.jdt.core-d9bc7897f13a47cf70b0edfdef55bb3d99dfc9d8.tar.xz
eclipse.jdt.core-d9bc7897f13a47cf70b0edfdef55bb3d99dfc9d8.zip
Bug 526590 - Content assist for abstract method parameter annotations
Removed the abstract method check so that block statements are parsed for abstract (including methods is interfaces) Change-Id: I7252a56049904bce415e9957e239d8990d91cbd1 Signed-off-by: Gayan Perera <gayanper@gmail.com>
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java64
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java2
2 files changed, 64 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java
index 04c5110e7f..4eadbbadcf 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java
@@ -14526,4 +14526,68 @@ public void testBug525421() throws JavaModelException {
"YES[FIELD_REF]{Flag.YES, LFlag;, LFlag;, YES, null, 104}",
requestor.getResults());
}
+
+
+public void testBug526590() throws JavaModelException {
+ // test for abstract method in abstract class
+ this.workingCopies = new ICompilationUnit[2];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/testbug526590/Bug526590.java",
+ "package testbug526590;\n" +
+ "public abstract class Bug526590 {\n" +
+ " public abstract void foo(@QQAnnotation() String param);\n" +
+ "}");
+ //SuppressWarnings
+
+ this.workingCopies[1] = getWorkingCopy(
+ "/Completion/src/testbug526590/QQAnnotation.java",
+ "package testbug526590;"+
+ "public @interface QQAnnotation {\n"+
+ "String[] value();\n"+
+ "}");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "@QQAnnotation(";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ assertResults(
+ "Bug526590[TYPE_REF]{Bug526590, testbug526590, Ltestbug526590.Bug526590;, null, null, 52}\n" +
+ "value[ANNOTATION_ATTRIBUTE_REF]{value, Ltestbug526590.QQAnnotation;, [Ljava.lang.String;, value, null, 52}",
+ requestor.getResults());
+}
+
+public void testBug526590b() throws JavaModelException {
+ // test for abstract method in interface
+ this.workingCopies = new ICompilationUnit[2];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/testbug526590/Bug526590.java",
+ "package testbug526590;\n" +
+ "public interface Bug526590 {\n" +
+ " void foo(@QQAnnotation() String param);\n" +
+ "}");
+ //SuppressWarnings
+
+ this.workingCopies[1] = getWorkingCopy(
+ "/Completion/src/testbug526590/QQAnnotation.java",
+ "package testbug526590;"+
+ "public @interface QQAnnotation {\n"+
+ "String[] value();\n"+
+ "}");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "@QQAnnotation(";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+
+ assertResults(
+ "Bug526590[TYPE_REF]{Bug526590, testbug526590, Ltestbug526590.Bug526590;, null, null, 52}\n" +
+ "value[ANNOTATION_ATTRIBUTE_REF]{value, Ltestbug526590.QQAnnotation;, [Ljava.lang.String;, value, null, 52}",
+ requestor.getResults());
+}
+
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index 526c3ba517..a6887a1656 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -1908,8 +1908,6 @@ public void parseBlockStatements(MethodDeclaration md, CompilationUnitDeclaratio
//convert bugs into parse error
- if (md.isAbstract())
- return;
if (md.isNative())
return;
if ((md.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0)

Back to the top