Is it possible to decompile JVM languages like Groovy, Scala to their initial form?
If I try and decompile a 4 line Groovy class I get about 20 lines of decompiled Java code.
It's more of a theoretical question than a practical one, cause there are no such decompilers on the market (not that I know of).
Thanks.
Yes, it's possible to a similar fidelity that a Java decompiler can manage (meaning: the code will look similar, but not necessarily identical).
You'd need a dedicated decompiler for each language, however.
Edit: I think I need to clarify what level of fidelity I'd expect:
for
replaced by while
, ...)All of those are errors that also occur on decompiling Java code, simply because the association from byte code to Java source code is not 1:1.
However, if you have a dedicated Groovy decompiler, then I strongly suspect it to produce much more readable code from decompiling compiled Groovy code than a Java decompiler ever could.