Skip to content

Commit

Permalink
Add test for Expression Optimization Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen1212055 committed Dec 22, 2024
1 parent d63fc67 commit 7f91028
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/org/jetbrains/java/decompiler/SingleClassesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ private void registerDefault() {
// TODO: broken stack processing, deleted ternary!
register(JAVA_17, "TestPatternMatchingLoops");
register(JAVA_8, "TestBoxingSuperclass");
// TODO: shouldBeOne is completely deleted
register(JAVA_8, "TestLVTReassignment");
}

private void registerEntireClassPath() {
Expand Down
50 changes: 50 additions & 0 deletions testData/results/pkg/TestLVTReassignment.dec
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package pkg;

public class TestLVTReassignment {
public void test() {
double one = 1.0;// 5
one = 0.0;// 7
if (one > 1.0) {// 8
}

this.blackhole(one);// 6 11
}// 12

void blackhole(double value) {
}// 16
}

class 'pkg/TestLVTReassignment' {
method 'test ()V' {
0 4
1 4
2 9
4 5
5 5
6 6
7 6
8 6
9 6
a 6
b 6
c 9
d 9
e 9
f 9
10 9
11 10
}

method 'blackhole (D)V' {
0 13
}
}

Lines mapping:
5 <-> 5
6 <-> 10
7 <-> 6
8 <-> 7
11 <-> 10
12 <-> 11
16 <-> 14
17 changes: 17 additions & 0 deletions testData/src/java8/pkg/TestLVTReassignment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package pkg;

public class TestLVTReassignment {
public void test() {
double one = 1;
double shouldBeOne = one;
one = 0;
if (one > 1) {
}

blackhole(shouldBeOne);
}

void blackhole(double value) {

}
}

0 comments on commit 7f91028

Please sign in to comment.