what is the impact of setting `kotlinOptions.jvmTa...
# announcements
d
what is the impact of setting
kotlinOptions.jvmTarget
to
JavaVersion.VERSION_1_8
or
JavaVersion.VERSION_15
– assuming i’m using Java 15? • (1.4.20 release notes where support for 15 was added) • (jvmTarget documentation) will my code run in an optimized manner – as it can take advantage of newer JDK features, etc?
e
it only affects the bytecode generated, not how the JVM runs it. you can use newer Java APIs regardless
the only difference at this point is indified string concat, which isn't enabled unless you use
freeCompilerArgs += "-Xstring-concat=..."
anyhow
d
i’m having a discussion elsewhere about which
jvmTarget
we should select. i’m struggling to understand how to make this decision.
i.e. is 15 less stable than 11 (as it was recently added?) – and should we just use 8, because it’s worked for us so far?
e
the only unstable addition is indified string concat and that's off by default, so if you don't turn it on, it doesn't matter whether you pick 8 or 15 if you're running with on Java 15. if you do turn it on, you need to target 15
d
thank you. is there any additional documentation i should be looking at to further educate myself on the matter?
e
targeting Java 8 or above does have the benefit of a better
@JvmDefault
+ delegation behavior, so I wouldn't go below that unless you need to run on older JREs
you already found the documentation