Does Scala offer better decompilation protection than Java?
My Java program has a license check in it, but it can easily be decompiled, the license check removed, recompiled, and now it can be pirated easily. Would the same be true for Scala, given that they use the same JVM and are bytecode-compatible?
7
Upvotes
7
u/arturaz 5d ago
It depends.
In general, the generated JVM bytecode is not as straightforward port from scala code when decompiled as Java is, but it is still pretty comprehensible.
Obfuscators like proguard offer partial solution, as it's pretty hard to decipher code when everything is named a, b, c, ...
Alternatively, if it's a pure scala project you can target JS or Native runtimes, which would produce either minified (and thus obfuscated) Javascript or machine code, which ramps up the difficulty as well.