Not sure which channel to ask in. I’ve been updati...
# server
a
Not sure which channel to ask in. I’ve been updating to Kotlin 1.8.20 and noticed that default target jvm seems to be 11. I don’t see this anywhere in release notes https://kotlinlang.org/docs/whatsnew18.html and compiler options documentation still states it is Java 1.8: https://kotlinlang.org/docs/compiler-reference.html#jvm-target-version Anybody else noticed the change?
👀 1
t
Why do you think 11 is default? 🤔
a
My dependency that was setting source/target 1.8 and was compiled using Kotlin 1.6 was failing when used as submodule in the project that was targeting java 11 and using Kotlin 1.8.20.
Had to add this
Copy code
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask).all {
    compilerOptions {
        compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8)
    }
}
Without it, looks like 1.8.10 goes to JVM_11 by default
t
what Gradle version are you using?
a
The module where I had to force JVM_1_8 is still Gradle 7.4.2
The project where I was using it as a submodule and failing, was updated to 8.0.4
t
and your Gradle JDK is 11 and you are not using Gradle JVM toolchain feature?
a
Local java version used to compile is Java 11. Submodule sets
Copy code
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Main project sets where submodule is used sets
Copy code
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
t
Starting from Gradle 8 - it configures by default JVM toolchain object effectively also configuring Kotlin JVM target. Interestingly it was not mentioned in Gradle 8.0 what's new 🤔 Though in Kotlin 1.8.0 what's new we've mentioned it (maybe not so clear). I would advice you to configure Java toolchain feature to avoid such errors. FYI: if you add another Gradle project as included build it will use main project Gradle version - in your case effectively Gradle 8.
v
Hi! Also, if you update to Kotlin 1.8.20 (probably RC2?), use What’s new in Kotlin 1.8.20-RC2, not What’s new for 1.8.0. And we don’t update documentation for 1.8.20 until it’s official announcement. So, if there even had been any changes (for the topic you mentioned) in docs for 1.8.20, you would see it only after an official release announcement.
a
I am on 1.8.10 at the moment