mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
method reference: capture wildcards of new expressions (IDEA-152115)
This commit is contained in:
@@ -119,9 +119,6 @@ public class PsiMethodReferenceUtil {
|
||||
}
|
||||
|
||||
methodReturnType = subst.substitute(methodReturnType);
|
||||
if (methodReturnType != null) {
|
||||
methodReturnType = PsiUtil.captureToplevelWildcards(methodReturnType, expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (resolve instanceof PsiClass) {
|
||||
@@ -145,6 +142,8 @@ public class PsiMethodReferenceUtil {
|
||||
methodReturnType = JavaPsiFacade.getElementFactory(expression.getProject()).createType(containingClass, subst);
|
||||
}
|
||||
|
||||
methodReturnType = PsiUtil.captureToplevelWildcards(methodReturnType, expression);
|
||||
|
||||
if (TypeConversionUtil.isAssignable(interfaceReturnType, methodReturnType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
private static Class<?>[] getArguments(Stream<Class<String>> classStream) {
|
||||
return classStream.toArray(Class<?>[]::new);
|
||||
}
|
||||
}
|
||||
@@ -494,6 +494,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCaptureTypeOfNewArrayExpression() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user