CFR tries to convert integer variables to short ones
AIRTEspresso opened this issue · comments
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, CFR used the var 'int n' for value 14756, and after that 'n' is assigned to the short arrays, where the error is. I think it is a minor mistake and CFR can easily solve it by adding a cast expression here, right?
The total case is available at error example and I hope it can be helpful.
Example
The source code:
class Test {
int N;
{
short s1 = 14756 , sArr[][][]= new short[N][N][N];
int i15 = 67;
sArr[i15][i15][i15]= s1;
}
}
The code decompiled by CFR:
class Test {
int N;
Test() {
int n = 14756;
short[][][] sArray = new short[this.N][this.N][this.N];
int n2 = 67;
sArray[n2][n2][n2] = n;
}
}
@AIRTEspresso Do you have a way to generate random java code samples?
@Kroppeb Yes, I use the JavaFuzzer: it can be found in Github JavaFuzzer