-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathTest.java
More file actions
37 lines (37 loc) · 792 Bytes
/
Test.java
File metadata and controls
37 lines (37 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Test {
void foo(String s, boolean unknown) {
int x = switch(s) {
case "a", "b" -> 1;
case "c" -> 2;
case "d" -> 2;
default -> 3;
};
switch (s) {
case "a", "b" -> { }
case "c" -> { }
case "d" -> { }
default -> { }
}
int len = s.length();
switch (s) {
case String _ when len == 4 -> { }
case "e" -> { }
default -> { }
}
switch (unknown ? s : s.toLowerCase()) {
case "f" -> { }
case String s2 when len == 4 -> { }
case "g" -> { }
default -> { }
}
switch (s) {
case "h":
case String _ when len == 4:
case "i":
String target = "Shouldn't be controlled by any of those tests";
break;
default:
break;
}
}
}