mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
method reference: include super substitutor into method reference substitutor when referenced method has no type parameters (IDEA-169134)
This commit is contained in:
@@ -107,13 +107,6 @@ public class PsiMethodReferenceUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiClass qContainingClass = getQualifierResolveResult(expression).getContainingClass();
|
||||
if (qContainingClass != null && containingClass != null &&
|
||||
isReceiverType(getFirstParameterType(functionalInterfaceType, expression), qContainingClass, subst)) {
|
||||
subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
|
||||
LOG.assertTrue(subst != null);
|
||||
}
|
||||
|
||||
methodReturnType = subst.substitute(methodReturnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,7 +1607,8 @@ public class InferenceSession {
|
||||
if (receiverSubstitutor != null) {
|
||||
if (!method.hasTypeParameters()) {
|
||||
if (signature.getParameterTypes().length == 1 || PsiUtil.isRawSubstitutor(containingClass, receiverSubstitutor)) {
|
||||
return receiverSubstitutor;
|
||||
return methodContainingClass != null ? JavaClassSupers.getInstance().getSuperClassSubstitutor(methodContainingClass, containingClass, reference.getResolveScope(), receiverSubstitutor)
|
||||
: receiverSubstitutor;
|
||||
}
|
||||
}
|
||||
mySiteSubstitutor = mySiteSubstitutor.putAll(receiverSubstitutor);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
interface MyBaseStream<T, S extends MyBaseStream<T, S>> {
|
||||
<R> MyStream<R> map(Function<? super T, ? extends R> mapper);
|
||||
}
|
||||
|
||||
interface MyStream<T> extends MyBaseStream<T, MyStream<T>> {}
|
||||
|
||||
{
|
||||
BiFunction<MyStream<Integer>, Function<Integer, Integer>, MyStream<Integer>> streamMapper = MyStream::map;
|
||||
}
|
||||
}
|
||||
@@ -537,6 +537,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMethodInInheritorFoundBySecondSearch() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNonExactMethodReferenceOnRawClassType() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user