Closed GraxCode closed 6 years ago
The one cast is there to select the right overload. Removes need to check stuff.
Casts to Object.class don't make any sense because every object you can cast is an object, the first one even triggers an compiler error, because it's not a typeless list. I would check if the cast is to Object.class and ignore it.
Bytecode has no binding generics rules. Krakatau is meant to decompile flow obf and all teh stuff correctly. User friendlyness is not first priority. ofc still valid to create sich requests.
A decompiler should decompile code correctly and not have invalid casts.
As Krakatau doesn't add generics to declarations its valid.
As Janmm mentioned, this is WAI.
As far as generics go, they are extremely complex to implement, and not all that useful for decompiling obfuscated apps, as the obfuscator will strip the generics information anyway. Therefore, it is highly unlikely to be implemented.
If you want a decompiler that outputs pretty code at the expense of not handling obfuscation, there are plenty of other decompilers to choose from.
I do not think it is working as intended, it could produce invalid code by casting to java.lang.Object that is mostly not wanted by classes with types. By ignoring all casts to (java.lang.Object) this issue would easily be resolved. It wouldn't change the behaviour.
You can easily remove the casts if you want. Just go to the top of java/ast.py
and change ALWAYS_CAST_PARAMS = 1
to ALWAYS_CAST_PARAMS = 0
.
Krakatau casts objects to objects http://prntscr.com/jecabk Bytecode: http://prntscr.com/jecalq
Or sometimes uses two casts http://prntscr.com/jecdz3 Bytecode: http://prntscr.com/jece3d