Files
Mikhail Pyltsinandintellij-monorepo-bot 0f76470f19 [java-inspections] IDEA-333452 Duplicate branch on switch. Improve work with comments
- now it can be suppressed properly
- show info level if the branches have different comments

GitOrigin-RevId: 5f1c5c0a67165b949b894d2d81c53800ad3b4b22
2023-09-27 19:37:38 +00:00

42 lines
762 B
Java

class C {
int foo(int n) {
int s = 0;
for (int i = 0; i < n; i++) {
switch (i % 4) {
case 1:
s += i;
continue;
case 2:
continue;
case 3:
<weak_warning descr="Duplicate branch in 'switch'">s += i;</weak_warning>
continue;
default:
s += i;
}
s /= 2;
}
return s;
}
int foo2(int n) {
int s = 0;
for (int i = 0; i < n; i++) {
switch (i % 4) {
case 1:
s += i;
continue;
case 2:
continue;
case 3:
//noinspection DuplicateBranchesInSwitch
s += i;
continue;
default:
s += i;
}
s /= 2;
}
return s;
}
}