Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/deleteSwitchLabel/beforeUnwrapPatternNoConflict1.java
Ilyas Selimov c3a56381e7 java - unwrap switch label fix: support used pattern variables in the switch
GitOrigin-RevId: 47387f009a92a5e17846da4fa131f754234d7cf6
2021-11-16 11:11:07 +00:00

23 lines
512 B
Java

// "Remove unreachable branches" "true"
import java.util.concurrent.ThreadLocalRandom;
class Test {
void test(Number n) {
n = 1;
switch (n) {
case <caret>Integer i && i == 1 -> {
int rand = ThreadLocalRandom.current().nextInt();
if (rand > 10) {
i = 2;
}
else {
i = 3;
}
System.out.println(i);
}
case Long s -> System.out.println(s);
default -> System.out.println();
}
}
}