mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
ensure array is not accepted as functional interface (IDEA-172048)
This commit is contained in:
@@ -112,7 +112,7 @@ public class LambdaUtil {
|
||||
if (type instanceof PsiIntersectionType) {
|
||||
return extractFunctionalConjunct((PsiIntersectionType)type) != null;
|
||||
}
|
||||
return isFunctionalClass(PsiUtil.resolveGenericsClassInType(type).getElement());
|
||||
return isFunctionalClass(PsiUtil.resolveClassInClassTypeOnly(type));
|
||||
}
|
||||
|
||||
@Contract("null -> false")
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
class Test {
|
||||
public static <T> void execute(Callable<T>[] cmds) { }
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
execute(<error descr="Callable<T>[] is not a functional interface">() -> null</error>);
|
||||
}
|
||||
}
|
||||
+1
@@ -156,6 +156,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testNestedLambdasWithInferenceOfReturnTypeInTheLatestLambda() { doTest(); }
|
||||
public void testCapturedWildcardNotOpenedDuringInference() { doTest(); }
|
||||
public void testIgnoreStandaloneExpressionsInLambdaReturnForNestedCalls() { doTest(); }
|
||||
public void testArrayNotAFunctionalInterface() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
|
||||
Reference in New Issue
Block a user