CFR may using unnecessary Object-cast expressions that confuse Java compilers
AIRTEspresso opened this issue · comments
AIRTEspresso commented
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. When decompiling method invocations of method declarations with the same name while different parameter types, CFR may use the Object-cast expression on the invocation args, which may confuse Java compilers, and even users.
The total case is available at error example and I hope it can be helpful.
Example
The source code:
class Test {
int N;
{
int iArr1[][][]= new int[N][N][N];
init(iArr1 , - 12);
}
static void init(float[]a , float seed){
}
static void init(Object a , Object seed){
}
}
The code decompiled by CFR:
class Test {
int N;
Test() {
int[][][] nArray = new int[this.N][this.N][this.N];
Test.init(nArray, (Object)-12);
}
static void init(float[] fArray, float f) {
}
static void init(Object object, Object object2) {
}
}