From b065e8672553fc9228217843383afcb4ee585e4c Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 16 Jul 2012 18:56:00 +0200 Subject: [PATCH] IDEA-88769 Java keyword completion: duplicate "final" suggestion --- .../com/intellij/codeInsight/completion/JavaCompletionData.java | 2 +- .../completion/keywords/finalAfterParameterAnno.java | 2 ++ .../intellij/codeInsight/completion/KeywordCompletionTest.java | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 java/java-tests/testData/codeInsight/completion/keywords/finalAfterParameterAnno.java diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java index 1167d982f121..55b5acfa6a0a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java @@ -142,7 +142,7 @@ public class JavaCompletionData extends JavaAwareCompletionData { END_OF_BLOCK, new PatternFilter(psiElement().afterLeaf( or( - psiElement().withoutText(".").inside(psiElement(PsiModifierList.class)), + psiElement().withoutText(".").inside(psiElement(PsiModifierList.class).withParent(not(psiElement(PsiParameter.class)))), psiElement().isNull()))) ), new PatternFilter(not(psiElement().afterLeaf("@")))); diff --git a/java/java-tests/testData/codeInsight/completion/keywords/finalAfterParameterAnno.java b/java/java-tests/testData/codeInsight/completion/keywords/finalAfterParameterAnno.java new file mode 100644 index 000000000000..2b539b837939 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/keywords/finalAfterParameterAnno.java @@ -0,0 +1,2 @@ +public class Util { + void foo(@Foo String[] args) { }} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java index 8ff29be3bdfb..21afce411e6f 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java @@ -101,6 +101,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase { public void testAbstractInInterface() throws Exception { doTest(1, "abstract"); } public void testCharInAnnotatedParameter() throws Exception { doTest(1, "char"); } public void testReturnInTernary() throws Exception { doTest(1, "return"); } + public void testFinalAfterParameterAnno() throws Exception { doTest(2, "final", "float", "class"); } public void testTryInExpression() throws Exception { configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");