I have an app written in Scala and some of my team members want a Java version of it. It is a demo app to use another API written in Scala, and they want a Java version of the app to be able to use the API from Java. However, the app is somewhat large and I don't want to manually rewerite in Java (and they don't want to learn Scala). Is there any tool that will automatically generate (readable) Java code from the Scala code?
they want a Java version of the app to be able to use the API from Java
Scala classes are usable from Java (since it's all JVM bytecode in the end). Can you just package a jar with your classes for them to use?
I don't think it's possible to convert from scala back to standard java since Scala does some pretty low-level byte-code manipulation. I'm 90% sure they do some things that can't exactly be translated back into normal Java code.
No, there is no such tool.
Scala in some sense is a coffescript of Java.
Look how all that funky classes in coffescript are translated to javascript. The same* would be with scala.
I don't think that there is a lot features that can't be translated to Java in any way, but most of the features will be translated to extremely cluttered code, even if the human will do that work.
But there is java to scala translators.
* not saying literally about classes
You have to decompile the .class files to java source files, beware that scala produces many more .class files
You can use javap from oracle included in the sdk or jad decompiler
for detailed explanation read the following article:
Not sure if this would work, but you could run the class files through a java decompiler.
If it works at all the result is bound to be ugly as hell.
© 2022 - 2024 — McMap. All rights reserved.