mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 15:50:53 +07:00
IDEA used to allow resolving if a statement or an expression that uses a pattern variable in a switch case label follows the switch case label immediately. This led to errors in resolving references to pattern variables when their enclosing statement or expression is not the immediate right sibling of the case label. Now IDEA looks for a switch case label among all the left siblings of the currently analyzing scope and enables resolving if a case label is found, and it's the same switch case label that is being analyzed. GitOrigin-RevId: 758c34fde30db2fe9692d8076c49af2b3efae38f
19 lines
384 B
Java
19 lines
384 B
Java
|
|
class Main {
|
|
void multipleReferencesToPatternVariable(Object o) {
|
|
switch (o) {
|
|
case Character c:
|
|
if (c == 7) {
|
|
System.out.println(c > 2);
|
|
}
|
|
if (c == 9) {
|
|
System.out.println(c + 2);
|
|
}
|
|
// hello, world
|
|
if (c == 11) { }
|
|
System.out.println(c);
|
|
default:
|
|
System.out.println();
|
|
}
|
|
}
|
|
} |