Closed ghost closed 2 years ago
Not really possible. This is a task of a decompiler. Maybe try to use another decompiler.
What could maybe help is to run the PeepholeOptimizer, It might be able to get rid of some of those unused booleany in fernflower output. Use it at the end.
For the PeepholeOptimizer it might help to run the deobfuscator on the result of the first deobfuscation again with only the PeepholeOptimizer.
If that does not help, you can try out the StackOperationSimplifier I created - you'd just have to build the PR manually: https://github.com/java-deobfuscator/deobfuscator/pull/816
These transformers might be able remove useless instructions before the super call in the constructor and with some luck, Fernflower can then apply syntactic sugar and inline the array creation.
In general, this project's main goal is deobfuscation for later analysis through the use of a decompiler. The second goal is that the created result behaves identical to the original. There is no specific goal to make bytecode superpretty for decompilers.
Jan's answer pretty much sums up my opinion (and hence why I am classifying this as out-of-scope of the project). Feel free to request general cleanup-related transformers, though.
A transformer that will force the super keyword to the top of a constructor, where it legally has to be. Some obfuscators move it down on purpose to crash/cause headache for decompilers.
pic 1: as it stands
pic 2: what is wanted
If there is an easier way to solve this problem, please tell me.