cfr
cfr copied to clipboard
TCB decompiled wrongly
CFR version
329eadca515e0f7939f40c3f2355c273548740ef
Compiler
Fingers
Description
I again had some fun making really ugly testcases. Output:
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public Object flowTest() {
MultiJump multiJump;
try {
multiJump = this;
}
catch (Exception exception) {
if (exception != null) {
return null;
}
multiJump = null;
}
Object.throwsNPE();
do {
// Infinite loop
} while (true);
}
Expected something like:
public Object flowTest() {
while (true) {
try {
Object.throwsNPE();
do {
// Infinite loop
} while (true);
}
catch (Exception ex) {
if (ex != null) {
return null;
}
continue;
}
break;
}
}
Object.throwsNPE(); should be in the try catch block. The CFR output would lead to throwing a NPE, while the real code would return null.
Example
Note: CFR 0.149 Output:
/*
* Unable to fully structure code
* Enabled unnecessary exception pruning
*/
public Object flowTest() {
try {
v0 = this;
lbl3: // 2 sources:
do {
Object.throwsNPE();
do {
// Infinite loop
} while (true);
break;
} while (true);
}
catch (Exception v1) {
if (v1 != null) {
return null;
}
v0 = null;
** continue;
}
}