Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.
/ scala-to-java Public archive

Command line tool that transpiles scala code into java code.

License

Notifications You must be signed in to change notification settings

Aivean/scala-to-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Scala To Java

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.

Usage

  • Make sure you have Java 1.8 and Maven installed
  • Checkout the project
  • In project directory invoke mvn clean package. In target directory scala-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 with END character (Ctrl-D)

Download

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.

Source highlighting and more

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'

Credits

Thanks to Stanley Shyiko, who actually implemented all the magic.