Repository navigation
build: Bump Kotlin to 2.4.21 and the language/API version to 2.0 - #6487
Closed
runningcode wants to merge 3 commits into
Closed
runningcode wants to merge 3 commits into
runningcode wants to merge 3 commits into
Conversation
Kotlin 2.4 rejects language and API version 1.9, so the Kotlin modules
now target 2.0 and depend on kotlin-stdlib 2.0.21. Kotlin applications
need Kotlin 1.9 or newer, up from 1.8.
KGP 2.4 replaced the experimental ABI validation DSL, so enable it
through abiValidation {}. Its dumper no longer lists synthetic
constructors, which drops three lines from the sqlite and navigation3
dumps. Compiling at 2.0 uses K2, which adds getEntries() to Kotlin
enums, references kotlin.jvm.JvmField from Compose $stable fields, and
compiles locals of suppressed internal Compose types to
error.NonExistentClass, so type those test locals explicitly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KGP 2.4 prefixes the Kotlin module name with the group, e.g. io.sentry:sentry-android-fragment_release. The compiler writes the .kotlin_module file with an underscore instead of the colon, but R8 writes the entry again from the module name, colon included, and app bundles reject it. That broke bundleRelease of the size test app. Pin the module name to the project name, which restores the module file names 8.x shipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
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.
📜 Description
Bumps Kotlin to 2.4.21 and raises the Kotlin language and API version of the published modules from 1.9 to 2.0. Those modules now depend on
kotlin-stdlib2.0.21 instead of 1.9.24.Kotlin applications that use the SDK need Kotlin 1.9 or newer, up from 1.8. A Kotlin compiler reads metadata one minor version ahead, so a 1.9 compiler can read our 2.0 classes. Java-only applications aren't affected.
Other changes the bump needed:
io.sentry:sentry-android-fragment_release. R8 writes that colon into the names of the.kotlin_modulefiles it outputs, and app bundles reject it (Entry name contains invalid characters).JdkTargetConventionnow pins the module name to the project name, so the module files keep the names 8.x shipped.SentryApiValidationPlugin: KGP 2.4 removed the experimental ABI validation API this plugin used (enabled,AbiValidationMultiplatformExtension). Validation is now enabled by callingabiValidation { }, which works the same for JVM, Android and multiplatform modules.sentry-android-fragment:FragmentLifecycleStategainsgetEntries(), because at language 2.0 the compiler generatesentriesfor Kotlin enums. This is an addition.sentry-android-sqlite,sentry-android-navigation3: the KGP 2.4 dumper no longer lists public synthetic constructors. The bytecode is unchanged; I compared it with 8.63.0.test-app-size: Compose's$stablefields now referencekotlin.jvm.JvmField. This app leaves out the Kotlin stdlib on purpose, so it gets one more-dontwarn.sentry-composetests: at language 2.0 the compiler uses its new K2 frontend. With@Suppress("INVISIBLE_REFERENCE"), K2 compiles locals whose inferred type is an internal Compose class (LayoutNode,Owner) toerror.NonExistentClass, and the tests failed withNoClassDefFoundError. Those locals are now typed explicitly.K2 also warns that suppressing
INVISIBLE_REFERENCEhas unspecified behavior. Session Replay's masking code (SentryLayoutNodeHelper,Nodes,ComposeViewHierarchyNode) and threesentry-composeclasses rely on it. Their compiled classes contain noerror.NonExistentClassand their unit tests pass, but the UI tests are the real check for them.SentryLog4j2AppenderAutoConfigurationTestinsentry-spring-boot-jakartais flaky, and also fails on 9.x.x without this change.💡 Motivation and Context
Kotlin 2.4 rejects language and API version 1.9, so keeping the 1.9 floor meant staying on Kotlin 2.3. 2.0 is the oldest version Kotlin 2.4 accepts. It's deprecated there, so the build prints a warning. This ships in SDK 9 together with its other new minimum requirements.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
🤖 Generated with Claude Code