IDEA-88769 Java keyword completion: duplicate "final" suggestion

This commit is contained in:
peter
2012-10-12 15:23:25 +02:00
parent db3f600a00
commit a9b4cd8d4f
3 changed files with 12 additions and 5 deletions
@@ -538,11 +538,14 @@ public class JavaCompletionData extends JavaAwareCompletionData {
return false;
}
if (psiElement().afterLeaf(
or(
psiElement().withoutText(".").inside(psiElement(PsiModifierList.class).withParent(not(psiElement(PsiParameter.class)))).andNot(
psiElement().inside(PsiAnnotationParameterList.class)),
psiElement().isNull())).accepts(position)) {
PsiElement prev = PsiTreeUtil.prevVisibleLeaf(position);
if (prev == null) {
return true;
}
if (psiElement().withoutText(".").inside(
psiElement(PsiModifierList.class).withParent(
not(psiElement(PsiParameter.class)).andNot(psiElement(PsiParameterList.class)))).accepts(prev) &&
!psiElement().inside(PsiAnnotationParameterList.class).accepts(prev)) {
return true;
}
@@ -0,0 +1,3 @@
public class Util {
void foo(@Foo <caret> int args) { }
}
@@ -105,6 +105,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
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 testFinalAfterParameterAnno2() throws Exception { doTest(2, "final", "float", "class"); }
public void testClassInMethod() throws Exception { doTest(2, "class", "char"); }
public void testIntInClassArray() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInClassArray2() throws Throwable { doTest(2, "int", "char", "final"); }