mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
collapse statement lambda to expression lambda: enable for value compatible lambdas (IDEA-122785)
This commit is contained in:
@@ -95,12 +95,7 @@ public class RedundantLambdaCodeBlockInspection extends BaseJavaBatchLocalInspec
|
||||
return returnStatement.getReturnValue();
|
||||
}
|
||||
else {
|
||||
final PsiExpression expression = ((PsiExpressionStatement)statements[0]).getExpression();
|
||||
final PsiType psiType = expression.getType();
|
||||
if (psiType != PsiType.VOID) {
|
||||
return null;
|
||||
}
|
||||
return expression;
|
||||
return ((PsiExpressionStatement)statements[0]).getExpression();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace with expression lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Runnable c = () -> foo();
|
||||
}
|
||||
|
||||
int foo() {return 1;}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with expression lambda" "false"
|
||||
// "Replace with expression lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Runnable c = () -> <caret>{foo();};
|
||||
|
||||
Reference in New Issue
Block a user