Commit ee750f16 authored by Anna.Kozlova's avatar Anna.Kozlova
Browse files

ensure array is not accepted as functional interface (IDEA-172048)

parent f9641720
Branches unavailable Tags unavailable
No related merge requests found
Showing with 12 additions and 1 deletion
+12 -1
......@@ -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")
......
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>);
}
}
......@@ -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());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment