As of Kotlin 1.6.0, for Kotlin/JVM projects one may specify the -jvm-target version
option up to Java 17
, see general and Gradle plugin documentation.
What are the benefits of doing so?
I couldn't find much on the benefits of specifying something other than the default value of 1.8
.
The only things I could find on this were:
- on JVM 9+ targets, string concatenations are compiled into dynamic invocations (invokedynamic), see release blog of Kotlin 1.5.20
- on JVM 10+ targets, Java's
Record
s are supported, see release blog of Kotlin 1.5.0.
Both seem negligible to me.
Especially because when specifying a higher target, one looses the ability to use the resulting artifact in projects stuck with Java 1.8, which seems undersireable especially for libraries.
Is there something I missed here?
invokedynamic
, I assumed. I might be on the wrong here though. – Cirillo