mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
lambda potential compatibility: don't treat array creation as void compatible
array creation can't be used as expression statement thus corresponding lambda body is value compatible but not void compatible GitOrigin-RevId: b0ddccad13c8699de64c4ce3e584214fe08a2353
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7fdfe09817
commit
00fbf3d133
@@ -600,7 +600,8 @@ public class LambdaUtil {
|
||||
public static boolean isExpressionStatementExpression(PsiElement body) {
|
||||
return body instanceof PsiAssignmentExpression ||
|
||||
PsiUtil.isIncrementDecrementOperation(body) ||
|
||||
body instanceof PsiCallExpression ||
|
||||
body instanceof PsiMethodCallExpression || //method invocation
|
||||
body instanceof PsiNewExpression && ((PsiNewExpression)body).getArrayInitializer() == null || //class instance creation
|
||||
body instanceof PsiReferenceExpression && !body.isPhysical();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
interface A {
|
||||
void enableInspections(B... providers);
|
||||
void enableInspections(Runnable r, String... inspections);
|
||||
}
|
||||
|
||||
interface B {
|
||||
Class[] get();
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo(A a) {
|
||||
a.enableInspections(() -> new Class[]{});
|
||||
}
|
||||
}
|
||||
@@ -275,6 +275,7 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testUnqualifiedStaticInterfaceMethodCallsOnInnerClasses() { doTest(false);}
|
||||
|
||||
public void testStaticMethodInSuperInterfaceConflictWithCurrentStatic() { doTest(false);}
|
||||
public void testPotentialCompatibilityWithArrayCreation() { doTest(false);}
|
||||
public void testOverloadsWithOneNonCompatible() { doTest(false);}
|
||||
public void testSecondSearchOverloadsBoxing() {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
|
||||
Reference in New Issue
Block a user