4 ms·
Can the decompiled result be compiled again?
by nunobrito 1y ago
Can the decompiled result be compiled again?
- jeroenhd 1y agoIt's not a perfect decompiler, some obfuscated code gets decompiled into commented-out bytecode. However, most of the time it'll output perfectly valid Java code that'll compile if you just create the necessary maven/ant/gradle build configuration to get all of the sources loaded correctly.
- dunham 1y agoI've actually had this fix a bug before. An O(n^2) issue adding a character at time to a string inside a loop. I had decompiled the class, fixed the issue, checked in the original decompiled source and then the change. Then a coworker pointed out that the original decompiled source also fixed the issue. After a bit of digging, I learned that hotspot compiler had code to detect and fix the issue, but it was looking for the pattern generated by a modern compiler, and the library was compiled with an older compiler. (It's been a while, but I think it was the JAI library, and the issue was triggered by long comments in a PNG.)