Skip to content

Commit 82cb56a

Browse files
committed
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. Verified with a full ./gradlew build (ktlint, detekt, apiCheck, Kover floor, and the R8 shrink-survival guard all pass).
1 parent b16a0d5 commit 82cb56a

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ allprojects {
142142

143143
dependencies {
144144
add("compileOnly", libs.slf4j.api)
145+
// Modern nullability annotations on the compile classpath. kotlin-stdlib pins the ancient
146+
// org.jetbrains:annotations:13.0 transitively, which lacks @UnknownNullability; Kotlin 2.4.0
147+
// tooling materialises inferred platform types with that annotation and reports it as
148+
// inaccessible against 13.0. compileOnly keeps it out of the published POM and ABI.
149+
add("compileOnly", libs.jetbrains.annotations)
145150
}
146151
}
147152

gradle/libs.versions.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
[versions]
2-
kotlin = "2.3.21"
2+
kotlin = "2.4.0"
33
kotlinx-coroutines = "1.11.0"
44
slf4j = "2.0.18"
5+
# Compile-only nullability annotations (@NotNull/@Nullable/@UnknownNullability). kotlin-stdlib drags
6+
# in the ancient 13.0 transitively, which predates UnknownNullability; Kotlin 2.4.0 tooling materialises
7+
# inferred platform types with that annotation, so a modern version must be on the compile classpath.
8+
jetbrains-annotations = "26.0.2"
59
okio = "3.17.0"
610
okhttp = "5.0.0"
711
mockwebserver = "5.0.0"
@@ -19,6 +23,7 @@ detekt = "1.23.6"
1923

2024
[libraries]
2125
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
26+
jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" }
2227
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
2328
slf4j-nop = { module = "org.slf4j:slf4j-nop", version.ref = "slf4j" }
2429
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }

0 commit comments

Comments
 (0)