Here is another case that CFR may generate invalid Java code. In this example, for the source code 'boolean b2 = false; bArr1[i20]= b2;', CFR generated 'int n2; blArray[n] = n2 = 0;' accordingly. I know that compilers tend to use integer 0 and 1 as false and true in the bytecode, and maybe it is the reason for this incompatible type conversion.
The total case is available at error example and I hope it can be helpful.
Example
The source code:
class Test {
int N;
{
int i20 = 35;
boolean bArr1[]= new boolean[N];
switch(30){
case 32 : {
boolean b2 = false;
bArr1[i20]= b2;
}
short s1 = 31371;
}
}
}
}
The code decompiled by CFR:
class Test {
int N;
Test() {
int n = 35;
boolean[] blArray = new boolean[this.N];
switch (30) {
case 32: {
int n2;
blArray[n] = n2 = 0;
n2 = 31371;
}
}
}
}
CFR version
CFR version: 0.152
Compiler
Java openJDK, version: 11.0.13
Description
Here is another case that CFR may generate invalid Java code. In this example, for the source code 'boolean b2 = false; bArr1[i20]= b2;', CFR generated 'int n2; blArray[n] = n2 = 0;' accordingly. I know that compilers tend to use integer 0 and 1 as false and true in the bytecode, and maybe it is the reason for this incompatible type conversion. The total case is available at error example and I hope it can be helpful.
Example
The source code:
The code decompiled by CFR: