Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for Expression Optimization Issue #449

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {

}
}