Skip to content

Second attempt to fix Kotlin 2.2 #4610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Aug 6, 2025

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Member Author

adinauer commented Aug 6, 2025

@adinauer adinauer mentioned this pull request Aug 6, 2025
7 tasks
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Second attempt to fix Kotlin 2.2 ([#4610](https://github.com/getsentry/sentry-java/pull/4610))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 1d5a803

Copy link
Contributor

github-actions bot commented Aug 6, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 416.02 ms 451.46 ms 35.44 ms
Size 1.58 MiB 2.09 MiB 523.94 KiB

Previous results on branch: 08-06-second_attempt_to_fix_kotlin_2.2

Startup times

Revision Plain With Sentry Diff
fe4d5ba 418.40 ms 445.61 ms 27.21 ms

App size

Revision Plain With Sentry Diff
fe4d5ba 1.58 MiB 2.09 MiB 523.75 KiB

@adinauer adinauer marked this pull request as ready for review August 7, 2025 14:35
@adinauer adinauer merged commit 7e8868f into 08-04-attempt_to_fix_kotlin_2.2_issue Aug 7, 2025
15 of 33 checks passed
@adinauer adinauer deleted the 08-06-second_attempt_to_fix_kotlin_2.2 branch August 7, 2025 14:35
@adinauer
Copy link
Member Author

adinauer commented Aug 7, 2025

Merging this so we don't have to review changes in other PRs that were replaced in this PR

@@ -145,7 +145,7 @@ fun toRequestUrl(uri: URI): StringBuffer? {
url.append(':').append(port)
}

if (uri?.isNotBlank()) {
if (uri.isNotBlank()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Null Safety Issue with URI Handling

The removal of the null-safe operator from uri?.isNotBlank() introduces a potential NullPointerException. The uri variable is assigned from uri.rawPath, which can return null according to Java URI documentation. This could cause a runtime NullPointerException or a compilation error when rawPath is null and assigned to a non-nullable String.

Fix in Cursor Fix in Web

kotlin {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Kotlin Version Mismatch in Sentry Modules

The sentry-android-fragment and sentry-android-timber modules are configured with Kotlin language and API version 1.8 (KOTLIN_1_8) via compilerOptions.languageVersion and compilerOptions.apiVersion. This is inconsistent with most other modules in the codebase, which are updated to Kotlin 1.9 (KOTLIN_1_9), potentially causing compatibility issues and appearing to be an oversight.

Additional Locations (1)
Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants