diff options
author | Vikas Chandra | 2020-07-21 15:21:08 +0000 |
---|---|---|
committer | Vikas Chandra | 2020-07-22 08:18:09 +0000 |
commit | 701a2aaba92ac6df72920cf9b4d65c03ed89647d (patch) | |
tree | 7c6bcb45621be97ccf772580323bb4351a995c0b | |
parent | 6fa78495565afa96e5ad245a143572f423a53493 (diff) | |
download | eclipse.jdt.core-701a2aaba92ac6df72920cf9b4d65c03ed89647d.tar.gz eclipse.jdt.core-701a2aaba92ac6df72920cf9b4d65c03ed89647d.tar.xz eclipse.jdt.core-701a2aaba92ac6df72920cf9b4d65c03ed89647d.zip |
Bug 565386 - Content Assist in AnnotationMethod gives ClassCastExceptionI20200727-1800I20200726-1800I20200724-1800I20200724-0600I20200723-1800I20200723-1030I20200723-0620I20200722-1800I20200722-1140I20200722-0610
Change-Id: If46884db8e7519a070571ba0eee18a7410446ca1
Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
2 files changed, 18 insertions, 1 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 1c712f8810..1af2738a43 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 @@ -14629,4 +14629,21 @@ public void testBug15589() throws JavaModelException { "Collection[TYPE_REF]{Collection, java.util, Ljava.util.Collection;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", result.proposals); } +public void test565386() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/MyAnno.java", + "package test;\n" + + "public @interface MyAnno {\n" + + "int age();"+ + "}\n"); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "age"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertTrue(requestor.getResults().equals("")); + +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java index 17de30f6a8..a5053f3a74 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java @@ -1732,7 +1732,7 @@ protected void consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() { } protected void consumeAnnotationTypeMemberDeclaration() { // AnnotationTypeMemberDeclaration ::= AnnotationTypeMemberDeclarationHeader AnnotationTypeMemberHeaderExtendedDims DefaultValueopt ';' - AnnotationMethodDeclaration annotationTypeMemberDeclaration = (AnnotationMethodDeclaration) this.astStack[this.astPtr]; + MethodDeclaration annotationTypeMemberDeclaration = (MethodDeclaration) this.astStack[this.astPtr]; annotationTypeMemberDeclaration.modifiers |= ExtraCompilerModifiers.AccSemicolonBody; // store the this.endPosition (position just before the '}') in case there is // a trailing comment behind the end of the method |