From 042a3ac663eca4ff7562434ec9cf1c4d7abdf7b0 Mon Sep 17 00:00:00 2001 From: OmarAlJarrah Date: Sat, 20 Jun 2026 16:30:30 +0300 Subject: [PATCH 1/2] build: upgrade Kotlin to 2.4.0 Bump the Kotlin version in the catalog from 2.3.21 to 2.4.0. The version is the single source of truth for the kotlin("jvm") plugin and kotlin-reflect, so the one change applies to every module. Add org.jetbrains:annotations 26.0.2 as a compile-only dependency on every Kotlin module (alongside slf4j-api). kotlin-stdlib transitively pins the ancient annotations 13.0, which predates @UnknownNullability; the 2.4.0 toolchain materialises inferred platform types with that annotation, and resolving it against 13.0 fails ("type annotation class ... is inaccessible"). Keeping it compile-only keeps it out of the published POM and the binary-compat ABI snapshots. --- build.gradle.kts | 5 +++++ gradle/libs.versions.toml | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index ec08a63c..5d009f9f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -142,6 +142,11 @@ allprojects { dependencies { add("compileOnly", libs.slf4j.api) + // Modern nullability annotations on the compile classpath. kotlin-stdlib pins the ancient + // org.jetbrains:annotations:13.0 transitively, which lacks @UnknownNullability; Kotlin 2.4.0 + // tooling materialises inferred platform types with that annotation and reports it as + // inaccessible against 13.0. compileOnly keeps it out of the published POM and ABI. + add("compileOnly", libs.jetbrains.annotations) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b670bde7..aa5f6b79 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,11 @@ [versions] -kotlin = "2.3.21" +kotlin = "2.4.0" kotlinx-coroutines = "1.11.0" slf4j = "2.0.18" +# Compile-only nullability annotations (@NotNull/@Nullable/@UnknownNullability). kotlin-stdlib drags +# in the ancient 13.0 transitively, which predates UnknownNullability; Kotlin 2.4.0 tooling materialises +# inferred platform types with that annotation, so a modern version must be on the compile classpath. +jetbrains-annotations = "26.0.2" okio = "3.17.0" okhttp = "5.0.0" mockwebserver = "5.0.0" @@ -19,6 +23,7 @@ detekt = "1.23.6" [libraries] kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } +jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } slf4j-nop = { module = "org.slf4j:slf4j-nop", version.ref = "slf4j" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } From 4d36f6379b8b3ab02e76a3e68c526c54bcc478d6 Mon Sep 17 00:00:00 2001 From: OmarAlJarrah Date: Sat, 20 Jun 2026 16:30:54 +0300 Subject: [PATCH 2/2] build: bump R8 to 9.1.31 for Kotlin 2.4.0 metadata parsing The test-only sdk-shrink-test module runs R8 over the SDK's Kotlin 2.4.0 output to prove it survives consumer-side shrinking. Older R8 releases only understand older Kotlin metadata versions, so keep R8 current (8.9.35 -> 9.1.31, the latest release) alongside the compiler bump. R8 enters no published artifact; it is fetched from Google's Maven repo solely for this guard. --- gradle/libs.versions.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index aa5f6b79..dc18ffdf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,8 +14,9 @@ netty = "4.2.13.Final" jackson = "2.18.2" junit-jupiter = "5.10.2" # R8 is used only by the test-only sdk-shrink-test module to verify the SDK survives consumer-side -# shrinking. It is fetched from Google's Maven repo and never enters a published artifact. -r8 = "8.9.35" +# shrinking. It is fetched from Google's Maven repo and never enters a published artifact. Kept current +# with the Kotlin bump so R8 can parse the metadata version emitted by the Kotlin compiler. +r8 = "9.1.31" kover = "0.9.8" binary-compatibility-validator = "0.16.3" ktlint-plugin = "12.1.1"