diff --git a/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java b/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java index 55e44c727da5..888a63434154 100644 --- a/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java @@ -415,7 +415,7 @@ public class CodeInsightUtil { PsiType argSubstitution = expectedType.getSubstitutor().substitute(parameter); PsiType substitution = JavaPsiFacade.getInstance(context.getProject()).getResolveHelper() - .getSubstitutionForTypeParameter(typeParam, paramSubstitution, argSubstitution, false, PsiUtil.getLanguageLevel(context)); + .getSubstitutionForTypeParameter(typeParam, paramSubstitution, argSubstitution, true, PsiUtil.getLanguageLevel(context)); if (substitution != null && substitution != PsiType.NULL) { return substitution; } diff --git a/java/java-tests/testData/codeInsight/completion/smartType/NewMapObjectTypeArguments-out.java b/java/java-tests/testData/codeInsight/completion/smartType/NewMapObjectTypeArguments-out.java new file mode 100644 index 000000000000..a4afb645a855 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/NewMapObjectTypeArguments-out.java @@ -0,0 +1,5 @@ +import java.util.*; + +public class SomeClass { + Map m = new HashMap(); +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/NewMapObjectTypeArguments.java b/java/java-tests/testData/codeInsight/completion/smartType/NewMapObjectTypeArguments.java new file mode 100644 index 000000000000..3b5df4d86cc3 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/NewMapObjectTypeArguments.java @@ -0,0 +1,5 @@ +import java.util.*; + +public class SomeClass { + Map m = new HashMap<>(); +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SmartTypeCompletionTest.java index 733b387e9a27..4657b0bc2c56 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/SmartTypeCompletionTest.java @@ -1266,5 +1266,6 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase { public void testNewHashMapTypeArguments() { doTest(); } public void testNewMapTypeArguments() { doTest(); } + public void testNewMapObjectTypeArguments() { doTest(); } }