0
可能重复:
Automated Java to Scala source code conversion?有没有办法从一个.java文件生成Scala代码
由于Scala语言和Java具有的所有功能,理论上应该是可能的生成从Java源代码文件翻译的Scala代码。有什么工具可以做这种翻译吗?
例如,在Java下面的代码:
public class MyClass {
String hello;
public MyClass(String hello){
this.hello = hello;
}
public void doSomething() {
Sysout.println(hello);
}
}
可以自动翻译成:
class MyClass(hello: String) {
def doSomething() {
println(hello);
}
}