Just asking a silly question for a friend of my fr...
# getting-started
z
Just asking a silly question for a friend of my friend think smart. Is there a plugin to convert a Kotlin module into Java module that can run without issues? The
decompile
function of Android Studio can generate Java files. But they have a lot of IDE highlights and imports from
kotlin.jvm
package, which does not seem to work.
j
But why does the friend of your friend want to do that ? 😁
r
Not really, no. The Kotlin compiler can generate JVM bytecode that cannot be directly represented in Java. Sure you can rewrite those parts to valid (even idiomatic) Java (as in, different code that accomplishes the same task), but there's a limit to which that can be done automatically, as it requires understanding intent instead of process.
z
The excuse I heard is that s/he is working on a part-time job, so s/he does not want to learn Kotlin . Please tell me the task is impossible 🙏.
@Ruckus Thank you, Sir. You just freed me from Mission Impossible 🙏.
t
there is a plugin for intellij that will show you the expected java-code from some kotlin-code. But it doesn't replace calls to the kotlin stdlib w/ calls to the java stdlib. So event if you wanted to run that java code, you'll still need the kotlin run-time.