IDEA-172200 Decompiler switch-on-enum multiple switches in same class generates wrong cases for all but the first switch-on-enum

This commit is contained in:
Egor.Ushakov
2017-05-05 13:10:53 +03:00
parent bbc76e7cb4
commit 17d4894848
8 changed files with 91 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -15,6 +15,37 @@ public class TestSwitchOnEnum {
return 0;// 20
}
}
static class Example {
void test(TestSwitchOnEnum.Example.A a, TestSwitchOnEnum.Example.B b) {
switch(a) {// 30
case A1:
System.out.println("A1");// 32
break;// 33
case A2:
System.out.println("A2");// 35
}
switch(b) {// 38
case B1:
System.out.println("B1");// 40
break;// 41
case B2:
System.out.println("B2");// 43
}
}// 46
static enum B {
B1,
B2;
}
static enum A {
A1,
A2;
}
}
}
class 'pkg/TestSwitchOnEnum' {
@@ -29,8 +60,39 @@ class 'pkg/TestSwitchOnEnum' {
}
}
class 'pkg/TestSwitchOnEnum$Example' {
method 'test (Lpkg/TestSwitchOnEnum$Example$A;Lpkg/TestSwitchOnEnum$Example$B;)V' {
8 20
24 22
27 22
29 22
2c 23
2f 25
32 25
34 25
3f 28
58 30
5b 30
5d 30
60 31
63 33
66 33
68 33
6b 36
}
}
Lines mapping:
14 <-> 9
16 <-> 11
18 <-> 13
20 <-> 15
30 <-> 21
32 <-> 23
33 <-> 24
35 <-> 26
38 <-> 29
40 <-> 31
41 <-> 32
43 <-> 34
46 <-> 37

View File

@@ -19,4 +19,30 @@ public class TestSwitchOnEnum {
}
return 0;
}
static class Example {
enum A { A1, A2}
enum B { B1, B2}
void test(A a, B b){
switch (a){
case A1:
System.out.println("A1");
break;
case A2:
System.out.println("A2");
break;
}
switch (b){
case B1:
System.out.println("B1");
break;
case B2:
System.out.println("B2");
break;
}
}
}
}