mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
java method reference inference: keep additional inference variables when second search is not possible (IDEA-252839)
GitOrigin-RevId: 358b0408221aaf6e51dbf87867ae8f33ba0d0fde
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2c2bce389a
commit
9970306c8f
@@ -209,7 +209,12 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
|
||||
if (qContainingClass != null && PsiUtil.isRawSubstitutor(qContainingClass, qualifierResolveResult.getSubstitutor())) {
|
||||
//15.13.1 If there exist a parameterization, then it would be used to search, the *raw type* would be used otherwise
|
||||
if (getParameterization(signature, qualifierResolveResult, method, myExpression, qContainingClass) == null) {
|
||||
referencedMethodReturnType = TypeConversionUtil.erasure(referencedMethodReturnType);
|
||||
if (!PsiMethodReferenceUtil.isSecondSearchPossible(signature.getParameterTypes(), qualifierResolveResult, myExpression)) {
|
||||
session.initBounds(myExpression, qContainingClass.getTypeParameters());
|
||||
}
|
||||
else {
|
||||
referencedMethodReturnType = TypeConversionUtil.erasure(referencedMethodReturnType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.util.*;
|
||||
|
||||
interface Foo<T> {
|
||||
static <E> Foo<E> of(E e1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
T get(int i);
|
||||
|
||||
}
|
||||
class MainTest {
|
||||
{
|
||||
Optional.of("one,two").map(Foo::<String>of).get().get(0).split(",");
|
||||
Optional.of("one,two").map(Foo::of).get().get(0).split(",");
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,7 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testCreateMethodFromMethodRefApplicability() { doTest(); }
|
||||
public void testErrorMessageOnTopCallWhenFunctionalInterfaceIsNotInferred() { doTest(); }
|
||||
public void testReferencesToPolymorphicMethod() { doTest(); }
|
||||
public void testTypeArgumentsOnFirstSearchAccessibleMethod() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
|
||||
Reference in New Issue
Block a user