diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index a2bfb596df34..31cc2cfa6c6e 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -1720,6 +1720,9 @@ public class InferenceSession { for (int i = 0; i < paramsLength; i++) { PsiType sType = getParameterType(parameters1, i, siteSubstitutor1, false); PsiType tType = session.substituteWithInferenceVariables(getParameterType(parameters2, i, siteSubstitutor1, varargs)); + if (PsiUtil.isRawSubstitutor(m2, siteSubstitutor1)) { + tType = TypeConversionUtil.erasure(tType); + } if (sType instanceof PsiClassType && tType instanceof PsiClassType && LambdaUtil.isFunctionalType(sType) && LambdaUtil.isFunctionalType(tType) && !relates(sType, tType)) { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/MoreSpecificForRawSignatureOnStaticProblem.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/MoreSpecificForRawSignatureOnStaticProblem.java new file mode 100644 index 000000000000..8ad8640d36fc --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/MoreSpecificForRawSignatureOnStaticProblem.java @@ -0,0 +1,26 @@ +import java.util.HashSet; +import java.util.Set; + +class TestCaller1 { + { + TestCaller1.foo(null); + } + public static void foo(HashSet fn) { } + public

void foo(Set fn) { } +} + +class TestCaller2 { + { + TestCaller2.foo(null); + } + public static void foo(HashSet fn) { } + public

void foo(Set fn) { } +} + +class TestCaller3 { + { + TestCaller2.foo(null); + } + public static void foo(HashSet fn) { } + public static void foo(Set fn) { } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java index ce45031e3074..bd5351b20358 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/OverloadResolutionTest.java @@ -270,6 +270,8 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase { public void testOverriddenMethodWithOtherRawSignature() { doTest(false);} + public void testMoreSpecificForRawSignatureOnStaticProblem() { doTest(false);} + public void testUnqualifiedStaticInterfaceMethodCallsOnInnerClasses() { doTest(false);} public void testStaticMethodInSuperInterfaceConflictWithCurrentStatic() { doTest(false);}