3 ms·
Incorrect, the Kotlin compiler allows you to specify the target JVM level, it can generate JVM 1.6 bytecode (for android) up to 16. I know for a fact it uses d
by dtech 5y ago
Incorrect, the Kotlin compiler allows you to specify the target JVM level, it can generate JVM 1.6 bytecode (for android) up to 16.
I know for a fact it uses different bytecode features if the level is >= 1.8, not sure how smart it is above that.
- pjmlp 5y agoIt can only generate bytecode features that ART understands, and D8 is able to convert into DEX, thus is the price of Android marriage. Going forward while for Java code there is no worry about using SIMD, JNI replacement, value types, Kotlin code will need to make use of KMM for code that is supposed to target both JVM and Android.
- dtech 5y agoAre you so dense that you cannot understand that the Kotlin compiler can do gasp different things depending on different settings? It can do stuff android doesn't support if you set the bytecode target level to > 1.8 It's like using modern Javascript features but providing a polyfill for older browsers.
- pjmlp 5y agoWhich produces libraries that are worthless to be consumed from Android without recompiling. Also stuff like value classes will have different semantics in memory consumption and performance across targets. Maybe some learning required?
- dtech 5y agoThose are bytecode level related. You can't consume Java 16 libraries on Android either. It's not related to Kotlin at all. You are either being deliberately obtuse or you genuinely have difficulty to understand that Java version, bytecode version, Kotlin compiler output and what bytecode Android supports are totally independent concepts.
- pjmlp 5y agoEnjoy #KotlinFirst, I am out of this thread. It is going to be fun to port back stuff to Java.