mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
IDEA-112552 "Replace with lambda" should use expression lambda when possible
This commit is contained in:
+8
-4
@@ -161,10 +161,14 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
|
||||
|
||||
final PsiStatement[] statements = body.getStatements();
|
||||
PsiElement copy = body.copy();
|
||||
if (statements.length == 1 && statements[0] instanceof PsiReturnStatement) {
|
||||
PsiExpression value = ((PsiReturnStatement)statements[0]).getReturnValue();
|
||||
if (value != null) {
|
||||
copy = value.copy();
|
||||
if (statements.length == 1) {
|
||||
if (statements[0] instanceof PsiReturnStatement) {
|
||||
PsiExpression value = ((PsiReturnStatement)statements[0]).getReturnValue();
|
||||
if (value != null) {
|
||||
copy = value.copy();
|
||||
}
|
||||
} else if (statements[0] instanceof PsiExpressionStatement) {
|
||||
copy = ((PsiExpressionStatement)statements[0]).getExpression().copy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user