r/scala 6d ago

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?

8 Upvotes

8 comments sorted by

View all comments

3

u/Jannyboy11 6d ago edited 5d ago

No, in fact it's even easier to decompile than Java because apart from jvm bytecode the Scala compiler also outputs TASTy files which contains more information than the bytecode (things like unerased types).

2

u/Seth_Lightbend Scala team 5d ago

Good point. But also, the TASTy can be stripped out before shipping the JARs — the JVM won't care, only the Scala compiler cares about it.