diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index d91b3aba7e2b..e75b14747528 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -141,6 +141,12 @@ public class JavaMethodCallElement extends LookupItem implements Type return false; } } + if (leaf != null) { + final PsiElement parent = leaf.getParent(); + if (parent instanceof PsiReferenceExpression && ((PsiReferenceExpression)parent).getTypeParameters().length > 0) { + return false; + } + } return SmartCompletionDecorator.hasUnboundTypeParams(getObject()); } diff --git a/java/java-tests/testData/codeInsight/completion/smartType/NoSecondMethodTypeArguments-out.java b/java/java-tests/testData/codeInsight/completion/smartType/NoSecondMethodTypeArguments-out.java new file mode 100644 index 000000000000..ffd936e30b6f --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/NoSecondMethodTypeArguments-out.java @@ -0,0 +1,9 @@ +import java.util.Collections; +import java.util.List; + +class A { + void foo(List x){} + { + foo(Collections.emptyList()); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/NoSecondMethodTypeArguments.java b/java/java-tests/testData/codeInsight/completion/smartType/NoSecondMethodTypeArguments.java new file mode 100644 index 000000000000..d81ea0d791b3 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/NoSecondMethodTypeArguments.java @@ -0,0 +1,9 @@ +import java.util.Collections; +import java.util.List; + +class A { + void foo(List x){} + { + foo(Collections.emptyList()); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java index 9e01d852bdda..b9c898483889 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java @@ -436,6 +436,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase { public void testCastAutoboxing3() throws Throwable { doActionItemTest(); } public void testCastWildcards() throws Throwable { doTest(); } + public void testNoSecondMethodTypeArguments() throws Throwable { doTest(Lookup.REPLACE_SELECT_CHAR); } + public void testNoFieldsInSuperConstructorCall() throws Throwable { doTest(); } public void testNoUninitializedFieldsInConstructor() throws Throwable { doTest(); } public void testFieldsSetInAnotherConstructor() throws Throwable { doTest(); }