Simple tool written in Scala that reveals the mystery of scala compiler. Reads scala code from the StdIn and writes it's decompiled Java version to StdOut.
- Make sure you have Java 1.8 and Maven installed
- Checkout the project
- In project directory invoke
mvn clean package
. In target directoryscala-to-java.jar
will be created - Run application with
java -jar target/scala-to-java.jar --slim
. Optional--slim
flag removes some boilerplate from the output - Type any scala code, for example
println("hello, world")
and finish withEND
character (Ctrl-D
)
Just in case you don't want to bother yourself with building the project, I already have built it for you. Please note that Java 8 is required to run this tool.
To improve usage experience, you may want to use external source code
highlighter (like pygmentize
) and pv
as the indicator of transpiling
process.
My setup:
alias scala-to-java='java -jar ~/.scala-to-java.jar --slim | pv -W | pygmentize -f 256 -l java -O style=monokai'
Thanks to Stanley Shyiko, who actually implemented all the magic.