As Scala.js is Scala compiled to JavaScript, it seems only fitting that it can also compile Java code. One of the things that make Scala so popular is its seamless integration with existing Java libraries and codebases. Enabling Scala.js to compile Java would greatly enhance its functionality and make it even more attractive to developers wanting to run their code in the browser, at the same time not being limited to using JavaScript or its derivatives.

Over the course of the few months it is possible to extend the compiler to a point where it can handle most Java code used in day-to-day development.

The idea, as stated in the project title, is to compile Java to Scala.js Intermediate Representation (IR). Then the existing compilation pipeline can be reused to produce JavaScript code from the IR. The key to this project is that, as complex as it may be, it would reuse a lot of great code. Reusing an existing Java parser and typechecker as well as the whole JavaScript generation framework will allow me to focus on converting the AST into IR efficiently and covering as many Java constructs as possible.



Piotr Moczurad


  • S├ębastien Doeraene