mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
method refs: take into account super class substitutor
This commit is contained in:
@@ -142,7 +142,7 @@ public class PsiMethodReferenceUtil {
|
||||
final QualifierResolveResult qualifierResolveResult = getQualifierResolveResult(methodReferenceExpression);
|
||||
final PsiElement resolve = result.getElement();
|
||||
if (resolve instanceof PsiMethod) {
|
||||
final MethodSignature signature1 = method.getSignature(resolveResult.getSubstitutor());
|
||||
final MethodSignature signature1 = method.getSignature(LambdaUtil.getSubstitutor(method, resolveResult));
|
||||
PsiSubstitutor subst = PsiSubstitutor.EMPTY;
|
||||
subst = subst.putAll(qualifierResolveResult.getSubstitutor());
|
||||
subst = subst.putAll(result.getSubstitutor());
|
||||
|
||||
@@ -267,7 +267,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
|
||||
}
|
||||
final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
|
||||
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
|
||||
final MethodSignature signature = interfaceMethod != null ? interfaceMethod.getSignature(resolveResult.getSubstitutor()) : null;
|
||||
final MethodSignature signature = interfaceMethod != null ? interfaceMethod.getSignature(LambdaUtil.getSubstitutor(interfaceMethod, resolveResult)) : null;
|
||||
final PsiType interfaceMethodReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
|
||||
final LanguageLevel languageLevel = PsiUtil.getLanguageLevel(PsiMethodReferenceExpressionImpl.this);
|
||||
if (isConstructor && interfaceMethod != null) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
class Double {
|
||||
public static Double sum(Double a, Double b) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
interface BinaryOperator<T> extends BiFunction<T,T,T> {
|
||||
}
|
||||
|
||||
interface BiFunction<T, U, R> {
|
||||
R apply(T t, U u);
|
||||
}
|
||||
|
||||
class U {
|
||||
{
|
||||
BinaryOperator<Double> doubleBinaryOperator = Double::sum;
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSuperClassSubst() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user