forked from fesh0r/fernflower
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[java-decompiler] IDEA-346717 Decompiler fails on static methods.
- add tests GitOrigin-RevId: 329e4a14c1f01d807c9e4d98c1c013378fcf2c02
- Loading branch information
1 parent
f34887a
commit ab7e7e1
Showing
4 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
public class SwitchOnStatic { | ||
public static void main(String[] args) { | ||
staticStringSelector();// 3 | ||
staticIntSelector();// 4 | ||
staticIntSelectorNotInlined();// 5 | ||
}// 6 | ||
|
||
public static void staticStringSelector() { | ||
switch (getStaticStringSelector()) {// 9 | ||
case "1" -> System.out.println("a");// 11 | ||
case "2" -> System.out.println("b");// 14 | ||
} | ||
|
||
}// 17 | ||
|
||
public static String getStaticStringSelector() { | ||
return "1";// 20 | ||
} | ||
|
||
public static void staticIntSelector() { | ||
switch (getStaticIntSelector()) {// 24 | ||
case 1 -> System.out.println("a");// 26 | ||
case 2 -> System.out.println("b");// 29 | ||
} | ||
|
||
}// 32 | ||
|
||
public static int getStaticIntSelector() { | ||
return 1;// 35 | ||
} | ||
|
||
public static void staticIntSelectorNotInlined() { | ||
int cc = getStaticIntSelector();// 39 | ||
switch (cc) {// 40 | ||
case 1 -> System.out.println("a");// 42 | ||
case 2 -> System.out.println("b");// 45 | ||
} | ||
|
||
}// 48 | ||
} | ||
|
||
class 'SwitchOnStatic' { | ||
method 'main ([Ljava/lang/String;)V' { | ||
0 2 | ||
3 3 | ||
6 4 | ||
9 5 | ||
} | ||
|
||
method 'staticStringSelector ()V' { | ||
0 8 | ||
3e 8 | ||
58 9 | ||
5b 9 | ||
5d 9 | ||
63 10 | ||
66 10 | ||
68 10 | ||
6b 13 | ||
} | ||
|
||
method 'getStaticStringSelector ()Ljava/lang/String;' { | ||
0 16 | ||
2 16 | ||
} | ||
|
||
method 'staticIntSelector ()V' { | ||
0 20 | ||
3 20 | ||
1c 21 | ||
1f 21 | ||
21 21 | ||
27 22 | ||
2a 22 | ||
2c 22 | ||
2f 25 | ||
} | ||
|
||
method 'getStaticIntSelector ()I' { | ||
0 28 | ||
1 28 | ||
} | ||
|
||
method 'staticIntSelectorNotInlined ()V' { | ||
0 32 | ||
3 32 | ||
5 33 | ||
20 34 | ||
23 34 | ||
25 34 | ||
2b 35 | ||
2e 35 | ||
30 35 | ||
33 38 | ||
} | ||
} | ||
|
||
Lines mapping: | ||
3 <-> 3 | ||
4 <-> 4 | ||
5 <-> 5 | ||
6 <-> 6 | ||
9 <-> 9 | ||
11 <-> 10 | ||
14 <-> 11 | ||
17 <-> 14 | ||
20 <-> 17 | ||
24 <-> 21 | ||
26 <-> 22 | ||
29 <-> 23 | ||
32 <-> 26 | ||
35 <-> 29 | ||
39 <-> 33 | ||
40 <-> 34 | ||
42 <-> 35 | ||
45 <-> 36 | ||
48 <-> 39 | ||
Not mapped: | ||
12 | ||
27 | ||
43 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
public class SwitchOnStatic { | ||
public static void main(String[] args) { | ||
staticStringSelector(); | ||
staticIntSelector(); | ||
staticIntSelectorNotInlined(); | ||
} | ||
|
||
public static void staticStringSelector() { | ||
switch (getStaticStringSelector()) { | ||
case "1": | ||
System.out.println("a"); | ||
break; | ||
case "2": | ||
System.out.println("b"); | ||
break; | ||
} | ||
} | ||
|
||
public static String getStaticStringSelector() { | ||
return "1"; | ||
} | ||
|
||
public static void staticIntSelector() { | ||
switch (getStaticIntSelector()) { | ||
case 1: | ||
System.out.println("a"); | ||
break; | ||
case 2: | ||
System.out.println("b"); | ||
break; | ||
} | ||
} | ||
|
||
public static int getStaticIntSelector() { | ||
return 1; | ||
} | ||
|
||
public static void staticIntSelectorNotInlined() { | ||
int cc = getStaticIntSelector(); | ||
switch (cc) { | ||
case 1: | ||
System.out.println("a"); | ||
break; | ||
case 2: | ||
System.out.println("b"); | ||
break; | ||
} | ||
} | ||
} |