[java-inspections] EA-838138, Fix empty cases

GitOrigin-RevId: b45993878b906f3a5209ad0b968b43f8d872dbbf
This commit is contained in:
Mikhail Pyltsin
2023-04-25 11:16:39 +00:00
committed by intellij-monorepo-bot
parent 699b5fd32c
commit 63396759c4
2 changed files with 15 additions and 1 deletions
@@ -582,7 +582,8 @@ public class EnhancedSwitchMigrationInspection extends AbstractBaseJavaLocalInsp
OldSwitchStatementBranch branch = branches.get(i);
if (!isConvertibleBranch(branch, i != size - 1)) return null;
PsiStatement[] statements = branch.getStatements();
if (branch.isFallthrough() || statements.length == 0) continue;
if (branch.isFallthrough() && statements.length == 0) continue;
if (statements.length == 0) return null;
if (statements.length > maxNumberStatementsForExpression) {
isInfo = true;
}
@@ -0,0 +1,13 @@
// "Replace with 'switch' expression" "false"
public class EnhancedSwitchIntentionBug {
public static void main(String[] args) {
int x;
switch<caret> (args[0]) {
case "1":
case "2":
case "3":
default:
}
}
}