mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java invert if: ignore redundant return stmts (IDEA-258495)
GitOrigin-RevId: 4a1fc182d5e8e053dd60288b85764a511e72c08a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5ea63d85c7
commit
101ad553b7
+2
-1
@@ -327,7 +327,8 @@ public class InvertIfConditionAction extends PsiElementBaseIntentionAction {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (thenBranch instanceof PsiContinueStatement) {
|
||||
if (thenBranch instanceof PsiContinueStatement ||
|
||||
thenBranch instanceof PsiReturnStatement && ((PsiReturnStatement)thenBranch).getReturnValue() == null) {
|
||||
PsiStatement elseBranch = ifStatement.getElseBranch();
|
||||
if (elseBranch != null) {
|
||||
elseBranch.delete();
|
||||
|
||||
-3
@@ -12,8 +12,5 @@ class A {
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,5 @@ class A {
|
||||
<caret>if (c) {
|
||||
foo();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user