build: upgrade Kotlin to 2.4.0 and R8 to 9.1.31#160
Merged
Conversation
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.
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.
82cb56a to
4d36f63
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Upgrades Kotlin from 2.3.21 to 2.4.0 across all modules, plus two supporting build changes the bump requires.
Changes
Kotlin 2.4.0 — the version lives once in
gradle/libs.versions.tomland drives both thekotlin("jvm")plugin andkotlin-reflect, so the single catalog change applies to every module.org.jetbrains:annotations26.0.2 (compile-only) — added to every Kotlin module next toslf4j-api.kotlin-stdlibtransitively pins the ancientorg.jetbrains:annotations:13.0, which predates@UnknownNullability. On 2.4.0 the toolchain materialises inferred platform types using that annotation, and resolving it against 13.0 fails with "type annotation classorg.jetbrains.annotations.UnknownNullabilityof the inferred type is inaccessible" (most visibly in the IDE on Java-interop call sites). Forcing a modern annotations version onto the compile classpath (13.0 -> 26.0.2) resolves it. Compile-only scope keeps it out of the published POM and the binary-compat ABI snapshots.R8 8.9.35 → 9.1.31 — the test-only
sdk-shrink-testmodule runs R8 over the SDK's Kotlin output to prove it survives consumer-side shrinking. Older R8 releases only understand older Kotlin metadata versions, so R8 is kept current (9.1.31 is the latest release) alongside the compiler bump. R8 enters no published artifact.Verification
Full
./gradlew buildis green — ktlint, detekt,allWarningsAsErrors, explicit-API strict,apiCheck, the 80% Kover floor, and the R8 shrink-survival guard (JDK 11 toolchain + R8 from Google Maven) all pass.