Automated Java to Scala source code conversion?
(Yes I know I can call Java code from Scala; but that is pointless; I want to DELETE the Java code, not keep it around and have to look at it and maintain it forever!)
Are there any utilities out there to convert Java source to Scala source?
I believe theoretically it should be possible to accomplish with minimal lossage.
I have found this but it seems inactive, probably buggy/incomplete... http://sourceforge.net/projects/java2scala/
IntelliJ kinda, sorta, does this. You need to open a project with your Java sources. You can then copy/paste expressions, methods, or entire classes in to a .scala file. This converts to equivalent Scala code.
The fidelity of conversion isn't perfect, and, for this reason, it doesn't support a bulk conversion yet.
Aside from this, Paul Phillips once started the Scalify project to translate code from Java to Scala (or, potentially, your favourite language), and even improve it in the process! He explains the concept in this video. However this effort was stalled, presumably because he turned his attention to directly contributing to the Scala compiler and standard library.
In IntelliJ IDEA theres is a refactoring called "Convert to Scala". It's under Refactor menu (after you install Scala plugin) Ctrl+Shift+G. So you don't need to play with copy/paste.
Just make sure you have a java file opened, there is no this option if it's a scala or other file.
I just published the following tool : Scalagen. I tried Jatran as well, but was frustrated with some bugs and difficult integration. Scalagen is extensible and comes with a Maven plugin.
(I haven't used this)
noticed this, Mar 2012: http://blog.mysema.com/2012/03/scalagen-java-to-scala-conversion.html
I don't think it's possible to automatically convert Java to Scala in the general case. Many of the lower-level constructs in Java don't exist in Scala (e.g. fields and static members), Scala places limitations on constructors that don't exist in Java, and Scala doesn't have raw types like Java (generics without the generic parameters specified).