mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
method refs: wildcards treatment (IDEA-99828)
This commit is contained in:
@@ -243,7 +243,7 @@ public class PsiMethodReferenceUtil {
|
||||
|
||||
final int min = Math.min(signatureParameterTypes2.length, signatureParameterTypes1.length);
|
||||
for (int i = 0; i < min; i++) {
|
||||
final PsiType type1 = psiSubstitutor.substitute(GenericsUtil.eliminateWildcards(signatureParameterTypes1[offset + i]));
|
||||
final PsiType type1 = GenericsUtil.eliminateWildcards(psiSubstitutor.substitute(signatureParameterTypes1[offset + i]));
|
||||
if (isVarargs && i == min - 1) {
|
||||
if (!TypeConversionUtil.isAssignable(((PsiArrayType)signatureParameterTypes2[i]).getComponentType(), type1) &&
|
||||
!TypeConversionUtil.isAssignable(signatureParameterTypes2[i], type1)) {
|
||||
@@ -251,7 +251,7 @@ public class PsiMethodReferenceUtil {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!TypeConversionUtil.isAssignable(signatureParameterTypes2[i], psiSubstitutor.substitute(GenericsUtil.eliminateWildcards(type1)))) {
|
||||
if (!TypeConversionUtil.isAssignable(signatureParameterTypes2[i], type1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
public class Main {
|
||||
public static <T> void make(final Consumer<? super T> consumer) {
|
||||
Sink<T> accept = (Sink<T>) consumer::accept;
|
||||
Consumer<T> accept1 = (Consumer<T>)consumer::accept;
|
||||
}
|
||||
}
|
||||
|
||||
interface Sink<T> extends Consumer<T> {
|
||||
|
||||
}
|
||||
|
||||
interface Consumer<T> {
|
||||
public void accept(T t);
|
||||
}
|
||||
@@ -163,6 +163,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCapturedWildcards() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user