Is there a comparison resource somewhere of how th...
# compiler
c
Is there a comparison resource somewhere of how the JDK impacts generated Kotlin code? I'm particularly interested in changes since Java 11. Does targetting a more recent Java version change the generated code, and how?
3
u
At the moment, I think there are only two features which are affected by JVM bytecode target version: 1. If JVM target >= 9, string concatenation uses invokedynamic 2. If JVM target >= 17, the
PermittedSubclasses
attribute is written, which makes switches over Kotlin sealed classes exhaustive in Java But there are plans to support more, e.g. KT-65688.
🙏 1
m
Did a quick search for
>= JvmTarget
and those were the 2 results indeed: https://github.com/search?q=repo%3AJetBrains%2Fkotlin%20%20%3E%3D%20JvmTarget&type=code
u
Yeah, records (
@JvmRecord data class
) are kinda related, but not really, since they are just forbidden unless JVM target is at least 15.
👍 1
m
Yea the user needs to opt-in but still an incentive to bump
jvmTarget
true 1