File tree Expand file tree Collapse file tree 3 files changed +88
-0
lines changed
test/org/jetbrains/java/decompiler Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,7 @@ private void registerDefault() {
372372 register (JAVA_16 , "TestReturnSwitchExpression2" );
373373 register (JAVA_16 , "TestReturnSwitchExpression3" );
374374 register (JAVA_16 , "TestReturnSwitchExpression4" );
375+ register (JAVA_16 , "TestSwitchExprString1" );
375376
376377 register (JAVA_16 , "TestConstructorSwitchExpression1" );
377378 register (JAVA_16 , "TestConstructorSwitchExpression2" );
Original file line number Diff line number Diff line change 1+ package pkg;
2+
3+ public class TestSwitchExprString1 {
4+ public TestSwitchExprString1.Type get(String s) {
5+ if (s == null) {// 9
6+ return TestSwitchExprString1.Type.B;// 10
7+ } else {
8+ byte var3 = -1;
9+ switch(s.hashCode()) {
10+ case 97:
11+ if (s.equals("a")) {
12+ var3 = 0;
13+ }
14+ default:
15+ return switch(var3) {// 13
16+ case 0 -> TestSwitchExprString1.Type.A;// 14
17+ default -> TestSwitchExprString1.Type.B;// 15
18+ };
19+ }
20+ }
21+ }
22+
23+ static enum Type {
24+ A,
25+ B;
26+ }
27+ }
28+
29+ class 'pkg/TestSwitchExprString1' {
30+ method 'get (Ljava/lang/String;)Lpkg/TestSwitchExprString1$Type;' {
31+ 0 4
32+ 1 4
33+ 4 5
34+ 5 5
35+ 6 5
36+ 7 5
37+ 8 8
38+ a 7
39+ b 7
40+ c 8
41+ d 8
42+ e 8
43+ f 8
44+ 10 8
45+ 24 10
46+ 25 10
47+ 26 10
48+ 27 10
49+ 28 10
50+ 29 10
51+ 2a 10
52+ 2d 11
53+ 2e 11
54+ 2f 14
55+ 30 14
56+ 44 15
57+ 45 15
58+ 46 15
59+ 4a 16
60+ 4d 14
61+ }
62+ }
63+
64+ Lines mapping:
65+ 9 <-> 5
66+ 10 <-> 6
67+ 13 <-> 15
68+ 14 <-> 16
69+ 15 <-> 17
Original file line number Diff line number Diff line change 1+ package pkg ;
2+
3+ public class TestSwitchExprString1 {
4+ enum Type {
5+ A , B
6+ }
7+
8+ public Type get (String s ) {
9+ if (s == null ) {
10+ return Type .B ;
11+ }
12+
13+ return switch (s ) {
14+ case "a" -> Type .A ;
15+ default -> Type .B ;
16+ };
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments