mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
[java-highlighting] [java-inspections] IDEA-327632
Conversion to enhanced switch produces incorrect code. - Added checks that branches don't have a fast exit GitOrigin-RevId: 33c6cffa421a3b0c3c5b9f9f1ea29127c7a99d29
This commit is contained in:
committed by
intellij-monorepo-bot
parent
23e26fa546
commit
2ba4582735
@@ -0,0 +1,18 @@
|
||||
// "Replace with enhanced 'switch' expression" "false"
|
||||
|
||||
class SwitchToExpressionWithBreak {
|
||||
public int test(Object o) {
|
||||
int i;
|
||||
sw<caret>itch (o) {
|
||||
case String s:
|
||||
if (s.length() == 1) {
|
||||
break;
|
||||
}
|
||||
i = 1;
|
||||
break;
|
||||
default:
|
||||
i = 2;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// "Replace with enhanced 'switch' expression" "false"
|
||||
|
||||
class SwitchToExpressionWithReturn {
|
||||
public int test(Object o) {
|
||||
int i;
|
||||
sw<caret>itch (o) {
|
||||
case String s:
|
||||
if (s.length() == 1) {
|
||||
return 1;
|
||||
}
|
||||
i = 1;
|
||||
break;
|
||||
default:
|
||||
i = 2;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user