Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingPatternsInSwitch/FallthroughPatternMatchingSwitch.java
Nikita Eshkeev 97eaa6abb6 [java][switch] IDEA-273874 "Can't resolve symbol" false-negative in switch with fall-through semantics
Remove the SwitchBlockHighlightingModel#checkFallthroughReferences because it might produce too much noise for and bring no value.

GitOrigin-RevId: 10d848aaa38ad5a4c15f77726ac835ab517068d5
2021-07-28 19:15:33 +00:00

98 lines
2.2 KiB
Java

class Main {
void ff(Object o) {
switch (o) {
case String s:
case null:
case <error descr="Illegal fall-through to a pattern">Integer i</error>:
System.out.println(i + 1);
break;
case Long l:
System.out.println(l);
case <error descr="Illegal fall-through to a pattern">Character c</error>:
System.out.println(c);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void f(Object o) {
switch (o) {
case null: {
}
case <error descr="Illegal fall-through to a pattern">Integer i</error>:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void g(Object o) {
switch (o) {
case null:
case Integer i:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void h(Object o) {
switch (o) {
case null: {
System.out.println();
break;
}
case Integer i:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void i(Object o) {
switch (o) {
case null:
System.out.println();
break;
case Integer i:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void k(Object o) {
switch (o) {
case String s:
System.out.println();
break;
case Integer i:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void l(Object o) {
switch (o) {
case String s: {
System.out.println();
break;
}
case Integer i:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
void m(Object o) {
switch (o) {
case String s:
case <error descr="Illegal fall-through to a pattern">Integer i</error>:
System.out.println(i + 1);
default:
throw new IllegalStateException("Unexpected value: " + o);
}
}
}