-
I have been following (as best I can from the outside) the work on J2KT. But I don't quite understand how this will interact with J2CL within the context of solutions like Kotlin/JS. After playing with Kotlin/JS, I am also a bit disappointed in the output from the compiler, as mentioned here. So I understand the reasoning behind choosing to build and use a toolchain separately. But, does that mean that we would be writing Kotlin that, at a source level (not IR level), translates to JS via J2KT? In that case, is it translating in a Closure JS-compatible manner, so as to be compatible with advanced compilation through Closure Compiler? Or, if not that, how does Kotlin factor into the dev flow? Thank you in advance for any guidance. Further background / motivationsThe question behind the post is really whether the same Kotlin code could be usable from J2KT or Kotlin/JS, I suppose. I realize that's a bit weird, but consider the following use case: Within the same mono-repo, we have:
With this arrangement of modules, it would be tempting to leverage Kotlin Multiplatform to share common Kotlin objects between the server and the frontend. But this complicates interaction with the 2nd case via Bazel/J2KT, right? Would there be a case, in J2KT, where the same objects could be used in all the above circumstances? Does KSP, Kotlin's new annotation processing system which supports Multiplatform, factor into this at all? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
There are 2 different things here that might have caused confusion. J2KT is a tool to translate Java to Kotlin in a semantically correct way with minimal user intervention. The idea is, you can take any Java source and translate that to Kotlin source (on the fly or offline). When it is finished, it could be helpful to mass migrate big code bases from Java to Kotlin (for example to take benefit from KMP). There is another ongoing project to make J2CL understand from Kotlin (as in ability to compile Kotlin source code) and will produce the output that J2CL is producing today for Java. |
Beta Was this translation helpful? Give feedback.
-
Probably related: https://www.youtube.com/watch?v=o14wGByBRAQ
|
Beta Was this translation helpful? Give feedback.
There are 2 different things here that might have caused confusion.
J2KT is a tool to translate Java to Kotlin in a semantically correct way with minimal user intervention. The idea is, you can take any Java source and translate that to Kotlin source (on the fly or offline). When it is finished, it could be helpful to mass migrate big code bases from Java to Kotlin (for example to take benefit from KMP).
This tool is being developed on top of J2CL however it doesn't conceptually fit and should not be considered an integral part of J2CL project (that's why there are no references to it in the roadmap).
There is another ongoing project to make J2CL understand from Kotlin (as in ability to c…