I am a big fan of Kotlin and would like to use it with Codename One instead of Java. Since Kotlin interops seamlessly with Java am I able to use it to build an app with Codename One?
Updated July 2017: Public beta of Kotlin support is now available: https://www.codenameone.com/blog/kotlin-support-public-beta.html
Updated Jun 2017: We've just announced we'll do it by the end of the year: https://www.codenameone.com/blog/kotlin-wora-ios-iphone-windows-android.html
Original answer below for reference:
There is no official support for that. We contacted the Kotlin team a while back after RoboVM was discontinued and offered to help with integration but this didn't lead anywhere. If there is interest in working together from their team we'll help.
This might be something you can do yourself e.g. Steve Hannah wrote support for Mirah (a subset of Ruby) before we brought him into our team: https://www.codenameone.com/search?q=mirah
You can edit our Ant script to call a gradle script that will instrument the code before sending it onward to the compiler. I'm not sure how hard that will be and might "just work" with no further effort.
However, there could be two potential problems:
Creative usage of bytecode that might fail in some cases (e.g. on iOS, Windows UWP translation). This is unlikely but possible as we test only with javac
Usage of API's we don't have - this is possible. E.g. the Kotlin compiler might implicitly rely on parts of the Java SE API we don't support in which case the fix might be harder but doable either in Kotlin or in Codename One or somewhere in between with a pre-post processor of the bytecode
© 2022 - 2024 — McMap. All rights reserved.