CLOVIS
09/27/2025, 1:08 PMCaused by: java.lang.UnsupportedClassVersionError: opensavvy/prepared/runner/testballoon/SuiteKt has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1022)
at runtime, but no problems at compile time, which confuses me.mbonnin
09/27/2025, 1:33 PMorg.gradle.jvm.version in the .module file which explains the absence of compile time errormbonnin
09/27/2025, 1:34 PMmbonnin
09/27/2025, 1:36 PMmbonnin
09/27/2025, 1:36 PMCLOVIS
09/27/2025, 1:38 PMCLOVIS
09/27/2025, 1:38 PMmbonnin
09/27/2025, 1:38 PMCLOVIS
09/27/2025, 1:39 PMCLOVIS
09/27/2025, 1:39 PMmbonnin
09/27/2025, 1:40 PMCLOVIS
09/27/2025, 1:40 PMmbonnin
09/27/2025, 1:40 PMmbonnin
09/27/2025, 1:40 PMCLOVIS
09/27/2025, 1:41 PMmbonnin
09/27/2025, 1:41 PMmbonnin
09/27/2025, 1:41 PMmbonnin
09/27/2025, 1:41 PMmbonnin
09/27/2025, 1:46 PMCLOVIS
09/27/2025, 1:48 PMinline fun <reified T> foo() {
println("Foo: ${T::class}")
}
foo<Any?>()
JDK 11: Foo java.lang.Object
JDK 17: Foo kotlin.Any?mbonnin
09/27/2025, 1:48 PMmbonnin
09/27/2025, 1:48 PMCLOVIS
09/27/2025, 1:49 PMCLOVIS
09/27/2025, 1:49 PMmbonnin
09/27/2025, 1:49 PMmbonnin
09/27/2025, 1:50 PMCLOVIS
09/27/2025, 1:51 PMCLOVIS
09/27/2025, 1:52 PMCLOVIS
09/27/2025, 1:52 PMmbonnin
09/27/2025, 1:53 PMCLOVIS
09/27/2025, 1:53 PMkotlin {
jvmToolchain(11)
}mbonnin
09/27/2025, 1:54 PMCLOVIS
09/27/2025, 1:54 PMCLOVIS
09/27/2025, 1:55 PM-release get added to the .module?mbonnin
09/27/2025, 1:55 PMmbonnin
09/27/2025, 1:56 PMmbonnin
09/27/2025, 1:56 PMorg.jetbrains.kotlin.jvmCLOVIS
09/27/2025, 1:56 PMmbonnin
09/27/2025, 1:57 PMmbonnin
09/27/2025, 1:57 PMCLOVIS
09/27/2025, 1:58 PMmbonnin
09/27/2025, 1:58 PMmbonnin
09/27/2025, 1:58 PMWith -release, how do you ensure Gradle downloads a JDK if the user doesn’t have one new enough?Wait, I’m not sure what you mean
CLOVIS
09/27/2025, 1:58 PM-release 17 , but the user is running Gradle on JDK 11, what happens?mbonnin
09/27/2025, 1:59 PMcompileJava should failmbonnin
09/27/2025, 2:00 PMkotlinc doesn’t use javac and so my guess is that it can probably produce 17 bytecode if you pass -Xjdk-release=17CLOVIS
09/27/2025, 2:00 PMmbonnin
09/27/2025, 2:00 PMkotlinc != javac IIRC, Kotlin doesn’t use the JDK to produce the bytecodeCLOVIS
09/27/2025, 2:00 PMkotlinc doesn’t use javac and so my guess is that it can probably produce 17 bytecode if you pass -Xjdk-release=17
Sure, but a JRE 17+ is required to run the tests.mbonnin
09/27/2025, 2:01 PMmbonnin
09/27/2025, 2:01 PMmbonnin
09/27/2025, 2:01 PMCLOVIS
09/27/2025, 2:01 PMmbonnin
09/27/2025, 2:02 PM11 or whatever the user has installed that is more recentI’d love that too, I might have made a FR somewhere, let me check
mbonnin
09/27/2025, 2:03 PMCLOVIS
09/27/2025, 2:03 PMmbonnin
09/27/2025, 2:03 PMCLOVIS
09/27/2025, 2:08 PMCLOVIS
09/27/2025, 2:08 PMmbonnin
09/27/2025, 2:09 PMopensavvy/prepared/runner/testballoon/SuiteKt is not a Test Balloon class so test balloon is fine (targets Java 11, as expected 😌 )CLOVIS
09/27/2025, 2:09 PMmbonnin
09/27/2025, 2:10 PMmbonnin
09/27/2025, 2:10 PM-release is only for your tests classes, right? Whatever you publish on maven central, you should make sure to enforce a consistent JVM target, independent of the Gradle JDK (or else it’s easy to produce inconsistent binaries dependending the host that publishes)mbonnin
09/27/2025, 2:11 PM-release, it should be -Xjdk-release everywherembonnin
09/27/2025, 2:11 PM-release is to shut off some KGP warning/errorsCLOVIS
09/27/2025, 2:13 PMmbonnin
09/27/2025, 2:15 PM-release and -Xjdk-release always and enforce a minimum version for the Gradle JDKmbonnin
09/27/2025, 2:15 PMCLOVIS
09/27/2025, 2:15 PMCLOVIS
09/27/2025, 2:16 PMmbonnin
09/27/2025, 2:16 PMmbonnin
09/27/2025, 2:16 PMmbonnin
09/27/2025, 2:17 PMmbonnin
09/27/2025, 2:18 PMbrew install zulu-jdk11CLOVIS
09/27/2025, 2:18 PMmbonnin
09/27/2025, 2:18 PMmbonnin
09/27/2025, 2:19 PMCLOVIS
09/27/2025, 2:19 PMmbonnin
09/27/2025, 2:20 PMCLOVIS
09/27/2025, 2:20 PMmbonnin
09/27/2025, 2:20 PMmbonnin
09/27/2025, 2:21 PMmin version, not exact version.mbonnin
09/27/2025, 2:21 PMmbonnin
09/27/2025, 2:21 PMmbonnin
09/27/2025, 2:21 PMCLOVIS
09/27/2025, 2:22 PMCLOVIS
09/27/2025, 2:22 PMmbonnin
09/27/2025, 2:30 PMCLOVIS
09/29/2025, 5:59 PMkotlin {
compilerOptions.freeCompilerArgs.add("-Xjdk-release=${Versions.JAVA_COMPAT}")
}
tasks.withType(JavaCompile::class) {
options.release = Versions.JAVA_COMPAT
}
?
Or is there something else I need?mbonnin
09/29/2025, 6:00 PMmbonnin
09/29/2025, 6:01 PMjvmTarget for kotlinc too, I'm not sure if -Xjdk-release is setting itmbonnin
09/29/2025, 6:02 PM-Xjdk-release (because there is no JDK on Android, just android.jar)CLOVIS
09/29/2025, 6:02 PMCLOVIS
09/29/2025, 6:03 PMmbonnin
09/29/2025, 6:03 PMCLOVIS
09/29/2025, 6:05 PMCLOVIS
09/29/2025, 6:05 PMmbonnin
09/29/2025, 6:05 PMmbonnin
09/29/2025, 6:05 PMmbonnin
09/29/2025, 6:06 PMcoreLibrariesVersionmbonnin
09/29/2025, 6:06 PMCLOVIS
09/29/2025, 6:06 PMCLOVIS
09/29/2025, 6:07 PMCLOVIS
09/29/2025, 6:08 PMmbonnin
09/29/2025, 6:09 PMCLOVIS
09/29/2025, 6:09 PMCLOVIS
09/29/2025, 6:09 PMCLOVIS
09/29/2025, 6:09 PMmbonnin
09/29/2025, 6:10 PMCLOVIS
09/29/2025, 6:10 PMCLOVIS
09/29/2025, 6:17 PMCLOVIS
09/29/2025, 6:17 PMCLOVIS
09/29/2025, 6:18 PMmbonnin
09/29/2025, 6:18 PMmbonnin
09/29/2025, 6:18 PMCLOVIS
09/29/2025, 6:19 PMCLOVIS
09/29/2025, 6:19 PMmbonnin
09/29/2025, 6:19 PMmbonnin
09/29/2025, 6:20 PMmbonnin
09/29/2025, 6:20 PMmbonnin
09/29/2025, 6:20 PM-release on Android because there is no -releasembonnin
09/29/2025, 6:20 PMandroid.jar , not your usual JRECLOVIS
09/29/2025, 6:21 PMmbonnin
09/29/2025, 6:21 PMremoveFirst() madness is coming from)CLOVIS
09/29/2025, 6:21 PMCLOVIS
09/29/2025, 6:21 PMCLOVIS
09/29/2025, 6:22 PMmbonnin
09/29/2025, 6:23 PMI can use -Xjdk-release, right, even if it's later consumed by Android?Yes but your consumers may have issues if they don't desugar or if desugaring doesn't support the api (like
removeFirst())mbonnin
09/29/2025, 6:24 PMif I have a Multiplatform library that has both the JVM and Android targets, then -Xjdk-release should only be set on the KotlinCompile task?correct, only for the JVM task
CLOVIS
09/29/2025, 6:24 PMmbonnin
09/29/2025, 6:24 PMWhat does Android use to compile Kotlin code? Is it another task?No idea TBH
CLOVIS
09/29/2025, 6:24 PMmbonnin
09/29/2025, 6:25 PMCompileKotlin task that gets the stdlib symbols from android.jar according to compileSdk (this is what I would expect)CLOVIS
09/29/2025, 6:28 PMCLOVIS
09/29/2025, 6:28 PM