diff --git a/CHANGELOG.md b/CHANGELOG.md index be7899e2dd6..b97cfc19909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Changelog > [!WARNING] -> SDK 9.0.0 will raise the minimum supported Java and Android versions: +> SDK 9.0.0 will raise the minimum supported Java, Android, and Kotlin versions: > - Java 8 support will be dropped. SDK 9.0.0 requires Java 11+. See [#6469](https://github.com/getsentry/sentry-java/issues/6469). > - The Android `minSdk` will be raised from 21 to 24. See [#5508](https://github.com/getsentry/sentry-java/issues/5508). +> - Apps that compile Kotlin will need Kotlin 2.0+. See [#6473](https://github.com/getsentry/sentry-java/issues/6473). ## Unreleased @@ -12,6 +13,7 @@ - Remove the deprecated `io.sentry.android.core.LoadClass`. Use `io.sentry.util.LoadClass` instead ([#6594](https://github.com/getsentry/sentry-java/pull/6594)) - `SentryOptions.getIgnoredErrors()`, `getIgnoredTransactions()`, `getIgnoredCheckIns()` and `getIgnoredSpanOrigins()` now return `List` instead of `List`, matching their setters ([#6489](https://github.com/getsentry/sentry-java/pull/6489)) - The SDK is now compiled for Java 11 instead of Java 8. JVM applications need Java 11 or newer ([#6459](https://github.com/getsentry/sentry-java/pull/6459)) +- The SDK is now compiled with Kotlin language/API version 2.1. Apps that compile Kotlin need Kotlin 2.0 or newer, up from 1.8. Apps written only in Java are not affected. Modules that depend on `kotlin-stdlib` now pin 2.1.21, up from 1.9.24. The other modules use the app's own stdlib ([#6646](https://github.com/getsentry/sentry-java/pull/6646)) - Default trace context status to `ok` when an active span has no explicit status ([#6418](https://github.com/getsentry/sentry-java/pull/6418)) - Remove the deprecated `traceSampling` option (`SentryOptions.setTraceSampling`/`isTraceSampling` and the `io.sentry.traces.trace-sampling` manifest key) ([#6415](https://github.com/getsentry/sentry-java/pull/6415)) - Use `tracePropagationTargets` to control which URL-aware outgoing requests get tracing headers. diff --git a/build-logic/src/main/kotlin/io/sentry/gradle/JdkTargetConvention.kt b/build-logic/src/main/kotlin/io/sentry/gradle/JdkTargetConvention.kt index dd0a8e275a6..c41ebec70d5 100644 --- a/build-logic/src/main/kotlin/io/sentry/gradle/JdkTargetConvention.kt +++ b/build-logic/src/main/kotlin/io/sentry/gradle/JdkTargetConvention.kt @@ -13,8 +13,12 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.jvm.toolchain.JavaLanguageVersion import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget +import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile /** The JDK every module compiles and tests with, whatever JDK runs Gradle. */ @@ -23,6 +27,12 @@ private val BUILD_JDK = JavaLanguageVersion.of(21) /** The level the SDK publishes. */ private val PUBLISHED_JAVA_VERSION = JavaVersion.VERSION_11 +/** + * The Kotlin language and API version the SDK publishes. A Kotlin compiler reads metadata up to one + * version newer than its own, so apps that compile Kotlin need Kotlin 2.0 or newer. + */ +private val PUBLISHED_KOTLIN_VERSION = KotlinVersion.KOTLIN_2_1 + /** * Holds every toolchain, bytecode level decision and compilation option of a module. It does the * following @@ -34,6 +44,9 @@ private val PUBLISHED_JAVA_VERSION = JavaVersion.VERSION_11 * - published Android modules main code targets Java 11 * - minSdk is set for Android libraries * - javac warnings fail the build + * - Kotlin module names stay the project name + * - published modules main code compiles Kotlin with the published language/API version + * - Kotlin doesn't warn about the deprecated language/API version the SDK targets */ class JdkTargetConvention : Plugin { override fun apply(project: Project) { @@ -112,6 +125,52 @@ class JdkTargetConvention : Plugin { listOf("com.android.library", "com.android.application").forEach { pluginId -> project.plugins.withId(pluginId) { project.targetBuildJdkForUnitTests() } } + + project.keepKotlinModuleNameWithoutGroup() + + // Test code isn't published, so it keeps the compiler's default and may use newer features. + project.plugins.withId("com.vanniktech.maven.publish") { + project.tasks.withType(KotlinCompilationTask::class.java).configureEach { + if (!name.contains("Test")) { + compilerOptions.languageVersion.set(PUBLISHED_KOTLIN_VERSION) + compilerOptions.apiVersion.set(PUBLISHED_KOTLIN_VERSION) + } + } + } + + // The SDK targets the oldest language/API version its consumers' Kotlin can read, which newer + // compilers deprecate. That's deliberate, so the warning on every compilation is noise. + project.tasks.withType(KotlinCompilationTask::class.java).configureEach { + compilerOptions.freeCompilerArgs.add("-Xsuppress-version-warnings") + } + } + + /** + * KGP 2.4 prefixes the Kotlin module name with the group, e.g. `io.sentry:sentry-okhttp`. R8 copies + * that name into the names of the `.kotlin_module` entries it writes under `META-INF`, and app + * bundles reject the colon, so the module name stays the project name, as before KGP 2.4. + */ + private fun Project.keepKotlinModuleNameWithoutGroup() { + val moduleName = name + plugins.withId("org.jetbrains.kotlin.jvm") { + extensions.getByType(KotlinJvmProjectExtension::class.java).compilerOptions.moduleName.set( + moduleName + ) + } + plugins.withId("org.jetbrains.kotlin.android") { + extensions.getByType(KotlinAndroidProjectExtension::class.java).compilerOptions.moduleName.set( + moduleName + ) + } + plugins.withId("org.jetbrains.kotlin.multiplatform") { + val targets = extensions.getByType(KotlinMultiplatformExtension::class.java).targets + targets.withType(KotlinJvmTarget::class.java).configureEach { + compilerOptions.moduleName.set(moduleName) + } + targets.withType(KotlinAndroidTarget::class.java).configureEach { + compilerOptions.moduleName.set(moduleName) + } + } } private fun Project.minSdk(): Int = diff --git a/build-logic/src/main/kotlin/io/sentry/gradle/SentryApiValidationPlugin.kt b/build-logic/src/main/kotlin/io/sentry/gradle/SentryApiValidationPlugin.kt index f4c1dca5948..3e83a8e25c2 100644 --- a/build-logic/src/main/kotlin/io/sentry/gradle/SentryApiValidationPlugin.kt +++ b/build-logic/src/main/kotlin/io/sentry/gradle/SentryApiValidationPlugin.kt @@ -1,12 +1,9 @@ package io.sentry.gradle -import org.gradle.api.GradleException import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.plugins.ExtensionAware import org.gradle.kotlin.dsl.create -import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationExtension -import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationMultiplatformExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation private val KOTLIN_PLUGIN_IDS = @@ -34,14 +31,12 @@ class SentryApiValidationPlugin : Plugin { } private fun enable(project: Project, extension: ApiValidationExtension) { - val kotlin = project.extensions.getByName("kotlin") as ExtensionAware - when (val abi = kotlin.extensions.getByName("abiValidation")) { - is AbiValidationMultiplatformExtension -> abi.also { it.enabled.set(true) } - is AbiValidationExtension -> abi.also { it.enabled.set(true) } - else -> throw GradleException("Unexpected abiValidation extension: ${abi.javaClass.name}") - }.filters { - // Lazy, because the module configures the extension after this plugin has been applied. - exclude { byNames.addAll(extension.ignoredPackages.map { it.map { pkg -> "$pkg.**" } }) } + val kotlin = project.extensions.getByName("kotlin") as KotlinTopLevelExtension + kotlin.abiValidation { + filters { + // Lazy, because the module configures the extension after this plugin has been applied. + exclude { byNames.addAll(extension.ignoredPackages.map { it.map { pkg -> "$pkg.**" } }) } + } } } } diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index bcd9317e473..596d9f47d45 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -1,7 +1,7 @@ object Config { val kotlinStdLib = "stdlib-jdk8" - val kotlinStdLibVersionAndroid = "1.9.24" + val kotlinStdLibVersionAndroid = "2.1.21" val kotlinTestJunit = "test-junit" object Android { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7b3a04b0ea0..eae29449e07 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,8 +18,7 @@ feign = "13.17" gummyBears = "0.16.0" jackson = "2.18.3" jetbrainsCompose = "1.6.11" -kotlin = "2.3.21" -kotlin-compatible-version = "1.9" +kotlin = "2.4.21" ksp = "2.3.14" ktorClient = "3.6.1" logback = "1.2.9" diff --git a/sentry-android-distribution/build.gradle.kts b/sentry-android-distribution/build.gradle.kts index cd4078eded8..afcea43fd95 100644 --- a/sentry-android-distribution/build.gradle.kts +++ b/sentry-android-distribution/build.gradle.kts @@ -1,5 +1,4 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("com.android.library") @@ -34,7 +33,6 @@ android { kotlin { compilerOptions.jvmTarget = JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 explicitApi() } diff --git a/sentry-android-fragment/api/sentry-android-fragment.api b/sentry-android-fragment/api/sentry-android-fragment.api index ddd7d0f6699..8cb71e51a91 100644 --- a/sentry-android-fragment/api/sentry-android-fragment.api +++ b/sentry-android-fragment/api/sentry-android-fragment.api @@ -34,6 +34,7 @@ public final class io/sentry/android/fragment/FragmentLifecycleState : java/lang public static final field STOPPED Lio/sentry/android/fragment/FragmentLifecycleState; public static final field VIEW_CREATED Lio/sentry/android/fragment/FragmentLifecycleState; public static final field VIEW_DESTROYED Lio/sentry/android/fragment/FragmentLifecycleState; + public static fun getEntries ()Lkotlin/enums/EnumEntries; public static fun valueOf (Ljava/lang/String;)Lio/sentry/android/fragment/FragmentLifecycleState; public static fun values ()[Lio/sentry/android/fragment/FragmentLifecycleState; } diff --git a/sentry-android-fragment/build.gradle.kts b/sentry-android-fragment/build.gradle.kts index f83470a4fdc..a5a2797098a 100644 --- a/sentry-android-fragment/build.gradle.kts +++ b/sentry-android-fragment/build.gradle.kts @@ -1,6 +1,5 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("com.android.library") @@ -36,8 +35,6 @@ android { kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9 } testOptions { diff --git a/sentry-android-integration-tests/test-app-size/proguard-rules.pro b/sentry-android-integration-tests/test-app-size/proguard-rules.pro index e26a4ca5136..958c0bfe417 100644 --- a/sentry-android-integration-tests/test-app-size/proguard-rules.pro +++ b/sentry-android-integration-tests/test-app-size/proguard-rules.pro @@ -40,6 +40,7 @@ -dontwarn timber.log.Timber$Tree -dontwarn kotlin.Deprecated -dontwarn kotlin.Function +-dontwarn kotlin.jvm.JvmField -dontwarn kotlin.jvm.JvmStatic -dontwarn kotlin.jvm.functions.Function2 -dontwarn kotlin.jvm.functions.Function3 diff --git a/sentry-android-navigation/build.gradle.kts b/sentry-android-navigation/build.gradle.kts index a9e75743b05..6aa843adc44 100644 --- a/sentry-android-navigation/build.gradle.kts +++ b/sentry-android-navigation/build.gradle.kts @@ -1,6 +1,5 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("com.android.library") @@ -37,8 +36,6 @@ android { kotlin { compilerOptions.jvmTarget = JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9 } testOptions { diff --git a/sentry-android-navigation3/api/sentry-android-navigation3.api b/sentry-android-navigation3/api/sentry-android-navigation3.api index 45f0482ed82..4b48dee36af 100644 --- a/sentry-android-navigation3/api/sentry-android-navigation3.api +++ b/sentry-android-navigation3/api/sentry-android-navigation3.api @@ -27,7 +27,6 @@ public final class io/sentry/compose/navigation3/SentryNavEffectKt { public final class io/sentry/compose/navigation3/SentryNavOptions { public static final field $stable I - public synthetic fun (ZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun equals (Ljava/lang/Object;)Z public final fun getCaptureBackStack ()Z public final fun getEnableNavigationBreadcrumbs ()Z diff --git a/sentry-android-navigation3/build.gradle.kts b/sentry-android-navigation3/build.gradle.kts index 9478825b347..f114619f704 100644 --- a/sentry-android-navigation3/build.gradle.kts +++ b/sentry-android-navigation3/build.gradle.kts @@ -1,6 +1,5 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("com.android.library") @@ -35,8 +34,6 @@ android { kotlin { compilerOptions.jvmTarget = JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9 } testOptions { diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt index cb31be75fc7..fc82e769c76 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt @@ -372,7 +372,7 @@ class BackStackConverterTest { "nil" to null, "nested" to mapOf("inner" to "value"), "tags" to listOf("a", "b", "c"), - "array" to arrayOf("a", 1, false, PrivacyMode.PUBLIC, 'z'), + "array" to arrayOf("a", 1, false, PrivacyMode.PUBLIC, 'z'), "ints" to intArrayOf(1, 2, 3), "chars" to charArrayOf('a', 'b'), "bytes" to byteArrayOf(4, 5), diff --git a/sentry-android-replay/build.gradle.kts b/sentry-android-replay/build.gradle.kts index 912e85075a6..4ae28422ca8 100644 --- a/sentry-android-replay/build.gradle.kts +++ b/sentry-android-replay/build.gradle.kts @@ -1,6 +1,5 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask plugins { @@ -45,8 +44,6 @@ android { kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9 } testOptions { diff --git a/sentry-android-sqlite/api/sentry-android-sqlite.api b/sentry-android-sqlite/api/sentry-android-sqlite.api index 7b9f633b46a..2f9ebbc1ff7 100644 --- a/sentry-android-sqlite/api/sentry-android-sqlite.api +++ b/sentry-android-sqlite/api/sentry-android-sqlite.api @@ -8,7 +8,6 @@ public final class io/sentry/android/sqlite/BuildConfig { public final class io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper : androidx/sqlite/db/SupportSQLiteOpenHelper { public static final field Companion Lio/sentry/android/sqlite/SentrySupportSQLiteOpenHelper$Companion; - public synthetic fun (Landroidx/sqlite/db/SupportSQLiteOpenHelper;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public fun close ()V public static final fun create (Landroidx/sqlite/db/SupportSQLiteOpenHelper;)Landroidx/sqlite/db/SupportSQLiteOpenHelper; public fun getDatabaseName ()Ljava/lang/String; @@ -23,7 +22,6 @@ public final class io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper$Compan public final class io/sentry/sqlite/SentrySQLiteDriver : androidx/sqlite/SQLiteDriver { public static final field Companion Lio/sentry/sqlite/SentrySQLiteDriver$Companion; - public synthetic fun (Landroidx/sqlite/SQLiteDriver;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public static final fun create (Landroidx/sqlite/SQLiteDriver;)Landroidx/sqlite/SQLiteDriver; public fun hasConnectionPool ()Z public fun open (Ljava/lang/String;)Landroidx/sqlite/SQLiteConnection; diff --git a/sentry-android-sqlite/build.gradle.kts b/sentry-android-sqlite/build.gradle.kts index 4c91c7bb59a..2b67d3a77d8 100644 --- a/sentry-android-sqlite/build.gradle.kts +++ b/sentry-android-sqlite/build.gradle.kts @@ -1,6 +1,5 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("com.android.library") @@ -36,8 +35,6 @@ android { kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9 } testOptions { diff --git a/sentry-android-timber/build.gradle.kts b/sentry-android-timber/build.gradle.kts index ef19cfac00a..ede37b06bf4 100644 --- a/sentry-android-timber/build.gradle.kts +++ b/sentry-android-timber/build.gradle.kts @@ -1,6 +1,5 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("com.android.library") @@ -43,8 +42,6 @@ android { kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 - compilerOptions.languageVersion = KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = KotlinVersion.KOTLIN_1_9 } testOptions { diff --git a/sentry-apollo-3/build.gradle.kts b/sentry-apollo-3/build.gradle.kts index 06f16dd0d6a..8f1d241b378 100644 --- a/sentry-apollo-3/build.gradle.kts +++ b/sentry-apollo-3/build.gradle.kts @@ -18,8 +18,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-apollo-4/build.gradle.kts b/sentry-apollo-4/build.gradle.kts index 5964666b15a..82506fe46b3 100644 --- a/sentry-apollo-4/build.gradle.kts +++ b/sentry-apollo-4/build.gradle.kts @@ -18,8 +18,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-apollo-5/build.gradle.kts b/sentry-apollo-5/build.gradle.kts index f06b85cdc62..6c78703a395 100644 --- a/sentry-apollo-5/build.gradle.kts +++ b/sentry-apollo-5/build.gradle.kts @@ -17,8 +17,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-apollo/build.gradle.kts b/sentry-apollo/build.gradle.kts index c10f2b66851..8669f12def6 100644 --- a/sentry-apollo/build.gradle.kts +++ b/sentry-apollo/build.gradle.kts @@ -18,8 +18,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-compose/build.gradle.kts b/sentry-compose/build.gradle.kts index 0c5d585989a..fda8693cd0d 100644 --- a/sentry-compose/build.gradle.kts +++ b/sentry-compose/build.gradle.kts @@ -1,7 +1,6 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { alias(libs.plugins.kotlin.multiplatform) @@ -23,22 +22,10 @@ kotlin { explicitApi() androidTarget { - compilerOptions { - jvmTarget.set(JvmTarget.JVM_11) - apiVersion.set(KotlinVersion.KOTLIN_1_9) - languageVersion.set(KotlinVersion.KOTLIN_1_9) - } + compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } publishLibraryVariants("release") } - jvm("desktop") { - compilerOptions { - jvmTarget.set(JvmTarget.JVM_11) - apiVersion.set(KotlinVersion.KOTLIN_1_9) - languageVersion.set(KotlinVersion.KOTLIN_1_9) - } - } - - coreLibrariesVersion = "1.8" + jvm("desktop") { compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } } sourceSets.all { // Allow all experimental APIs, since MPP projects are themselves experimental @@ -49,12 +36,6 @@ kotlin { } sourceSets { - getByName("commonMain") { - compilerOptions { - apiVersion.set(KotlinVersion.KOTLIN_1_9) - languageVersion.set(KotlinVersion.KOTLIN_1_9) - } - } getByName("androidMain") { dependencies { api(projects.sentry) diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt index ae51ee4bd23..acf405aec33 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt @@ -1,5 +1,8 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +// LayoutNode and Owner locals are typed explicitly: under these suppressions K2 infers their type +// as an error type, and the test then fails with NoClassDefFoundError: error/NonExistentClass. + package io.sentry.compose.gestures import androidx.compose.runtime.collection.mutableVectorOf @@ -59,8 +62,8 @@ class ComposeGestureTargetLocatorTest { @Test fun `returns null when no clickable elements`() { - val root = mockLayoutNode(isPlaced = true, tag = "root", width = 100, height = 100) - val owner = mockOwner(root) + val root: LayoutNode = mockLayoutNode(isPlaced = true, tag = "root", width = 100, height = 100) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNull(result) @@ -68,7 +71,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects clickable via SemanticsModifier OnClick`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "btn", @@ -76,7 +79,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("OnClick"), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -84,7 +87,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(clickableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNotNull(result) @@ -94,7 +97,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects scrollable via SemanticsModifier ScrollBy`() { - val scrollableChild = + val scrollableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "list", @@ -102,7 +105,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("ScrollBy"), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -110,7 +113,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(scrollableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) assertNotNull(result) @@ -119,7 +122,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects clickable via ClickableElement modifier`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "btn", @@ -127,7 +130,7 @@ class ComposeGestureTargetLocatorTest { height = 50, nodeModifierClassName = "androidx.compose.foundation.ClickableElement", ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -135,7 +138,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(clickableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNotNull(result) @@ -144,7 +147,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects clickable via CombinedClickableElement modifier`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "btn", @@ -152,7 +155,7 @@ class ComposeGestureTargetLocatorTest { height = 50, nodeModifierClassName = "androidx.compose.foundation.CombinedClickableElement", ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -160,7 +163,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(clickableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNotNull(result) @@ -169,7 +172,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects scrollable via ScrollingLayoutElement modifier`() { - val scrollableChild = + val scrollableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "scroll", @@ -177,7 +180,7 @@ class ComposeGestureTargetLocatorTest { height = 50, nodeModifierClassName = "androidx.compose.foundation.ScrollingLayoutElement", ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -185,7 +188,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(scrollableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) assertNotNull(result) @@ -194,7 +197,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects scrollable via ScrollingContainerElement modifier`() { - val scrollableChild = + val scrollableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "scroll", @@ -202,7 +205,7 @@ class ComposeGestureTargetLocatorTest { height = 50, nodeModifierClassName = "androidx.compose.foundation.ScrollingContainerElement", ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -210,7 +213,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(scrollableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) assertNotNull(result) @@ -219,7 +222,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `detects scrollable via ScrollableAreaElement modifier`() { - val scrollableChild = + val scrollableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "scroll", @@ -227,7 +230,7 @@ class ComposeGestureTargetLocatorTest { height = 50, nodeModifierClassName = "androidx.compose.foundation.ScrollableAreaElement", ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -235,7 +238,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(scrollableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) assertNotNull(result) @@ -244,7 +247,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `ignores clickable when looking for scrollable`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "btn", @@ -252,7 +255,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("OnClick"), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -260,7 +263,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(clickableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) assertNull(result) @@ -268,7 +271,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `ignores scrollable when looking for clickable`() { - val scrollableChild = + val scrollableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "list", @@ -276,7 +279,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("ScrollBy"), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -284,7 +287,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(scrollableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNull(result) @@ -292,7 +295,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `skips unplaced nodes`() { - val unplacedClickable = + val unplacedClickable: LayoutNode = mockLayoutNode( isPlaced = false, tag = "btn", @@ -300,7 +303,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("OnClick"), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -308,7 +311,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(unplacedClickable), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNull(result) @@ -316,7 +319,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `skips nodes outside bounds`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "btn", @@ -326,7 +329,7 @@ class ComposeGestureTargetLocatorTest { left = 200f, top = 200f, ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -334,7 +337,7 @@ class ComposeGestureTargetLocatorTest { height = 300, children = listOf(clickableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) // click at (5, 5) is outside the child bounds (200-250, 200-250) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) @@ -343,7 +346,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `child inherits parent tag`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -351,7 +354,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("OnClick"), ) - val taggedParent = + val taggedParent: LayoutNode = mockLayoutNode( isPlaced = true, tag = "parent_tag", @@ -359,7 +362,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(clickableChild), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -367,7 +370,7 @@ class ComposeGestureTargetLocatorTest { height = 200, children = listOf(taggedParent), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNotNull(result) @@ -376,7 +379,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `returns deepest clickable for clicks`() { - val deepChild = + val deepChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "deep_btn", @@ -384,7 +387,7 @@ class ComposeGestureTargetLocatorTest { height = 20, semanticsKeys = listOf("OnClick"), ) - val parentClickable = + val parentClickable: LayoutNode = mockLayoutNode( isPlaced = true, tag = "parent_btn", @@ -393,7 +396,7 @@ class ComposeGestureTargetLocatorTest { semanticsKeys = listOf("OnClick"), children = listOf(deepChild), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -401,7 +404,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(parentClickable), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNotNull(result) @@ -410,7 +413,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `returns first scrollable immediately`() { - val deepScrollable = + val deepScrollable: LayoutNode = mockLayoutNode( isPlaced = true, tag = "deep_scroll", @@ -418,7 +421,7 @@ class ComposeGestureTargetLocatorTest { height = 20, semanticsKeys = listOf("ScrollBy"), ) - val parentScrollable = + val parentScrollable: LayoutNode = mockLayoutNode( isPlaced = true, tag = "parent_scroll", @@ -427,7 +430,7 @@ class ComposeGestureTargetLocatorTest { semanticsKeys = listOf("ScrollBy"), children = listOf(deepScrollable), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -435,7 +438,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(parentScrollable), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) assertNotNull(result) @@ -444,7 +447,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `returns null when node has no tag and no parent tag`() { - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -452,7 +455,7 @@ class ComposeGestureTargetLocatorTest { height = 50, semanticsKeys = listOf("OnClick"), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -460,7 +463,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(clickableChild), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNull(result) @@ -469,7 +472,7 @@ class ComposeGestureTargetLocatorTest { @Test fun `finds tagged clickable nested under untagged containers`() { // Tree: root(no tag) -> container(no tag) -> container(no tag) -> clickable(tag="deep_btn") - val clickableChild = + val clickableChild: LayoutNode = mockLayoutNode( isPlaced = true, tag = "deep_btn", @@ -477,7 +480,7 @@ class ComposeGestureTargetLocatorTest { height = 10, semanticsKeys = listOf("OnClick"), ) - val innerContainer = + val innerContainer: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -485,7 +488,7 @@ class ComposeGestureTargetLocatorTest { height = 30, children = listOf(clickableChild), ) - val outerContainer = + val outerContainer: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -493,7 +496,7 @@ class ComposeGestureTargetLocatorTest { height = 60, children = listOf(innerContainer), ) - val root = + val root: LayoutNode = mockLayoutNode( isPlaced = true, tag = null, @@ -501,7 +504,7 @@ class ComposeGestureTargetLocatorTest { height = 100, children = listOf(outerContainer), ) - val owner = mockOwner(root) + val owner: Owner = mockOwner(root) val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) assertNotNull(result) diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt index 7679ce05bee..a41abd6cf05 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt @@ -1,5 +1,8 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // to access internal vals +// LayoutNode locals are typed explicitly: under these suppressions K2 infers their type as an error +// type, and the test then fails with NoClassDefFoundError: error/NonExistentClass. + package io.sentry.compose.viewhierarchy import androidx.compose.runtime.collection.mutableVectorOf @@ -26,10 +29,10 @@ class ComposeViewHierarchyExporterTest { fun testComposeViewHierarchyExport() { val rootVhNode = ViewHierarchyNode() - val childA = mockLayoutNode(true, "childA", 10, 20) - val childB = mockLayoutNode(true, null, 10, 20) - val childC = mockLayoutNode(false, null, 10, 20) - val parent = mockLayoutNode(true, "root", 30, 40, listOf(childA, childB, childC)) + val childA: LayoutNode = mockLayoutNode(true, "childA", 10, 20) + val childB: LayoutNode = mockLayoutNode(true, null, 10, 20) + val childC: LayoutNode = mockLayoutNode(false, null, 10, 20) + val parent: LayoutNode = mockLayoutNode(true, "root", 30, 40, listOf(childA, childB, childC)) val node = mock() whenever(node.root).thenReturn(parent) diff --git a/sentry-graphql-22/build.gradle.kts b/sentry-graphql-22/build.gradle.kts index 0d51375c359..e2096a929c5 100644 --- a/sentry-graphql-22/build.gradle.kts +++ b/sentry-graphql-22/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-graphql-core/build.gradle.kts b/sentry-graphql-core/build.gradle.kts index 73dd1a5f27e..2f6a1f4af98 100644 --- a/sentry-graphql-core/build.gradle.kts +++ b/sentry-graphql-core/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-graphql/build.gradle.kts b/sentry-graphql/build.gradle.kts index 5b862e4e448..ea37d8deee6 100644 --- a/sentry-graphql/build.gradle.kts +++ b/sentry-graphql/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-jcache/build.gradle.kts b/sentry-jcache/build.gradle.kts index de5ff284e7d..9bd3a0048f5 100644 --- a/sentry-jcache/build.gradle.kts +++ b/sentry-jcache/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-kotlin-extensions/build.gradle.kts b/sentry-kotlin-extensions/build.gradle.kts index 848b19819f4..1b44bc0a56d 100644 --- a/sentry-kotlin-extensions/build.gradle.kts +++ b/sentry-kotlin-extensions/build.gradle.kts @@ -17,8 +17,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-ktor-client/build.gradle.kts b/sentry-ktor-client/build.gradle.kts index b18559621b9..1db99e6ca42 100644 --- a/sentry-ktor-client/build.gradle.kts +++ b/sentry-ktor-client/build.gradle.kts @@ -18,8 +18,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } kotlin { explicitApi() } diff --git a/sentry-launchdarkly-server/build.gradle.kts b/sentry-launchdarkly-server/build.gradle.kts index 6e6df9e428c..8903db11440 100644 --- a/sentry-launchdarkly-server/build.gradle.kts +++ b/sentry-launchdarkly-server/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-okhttp/build.gradle.kts b/sentry-okhttp/build.gradle.kts index dbda6e5c9cd..936b703fd02 100644 --- a/sentry-okhttp/build.gradle.kts +++ b/sentry-okhttp/build.gradle.kts @@ -18,8 +18,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } kotlin { explicitApi() } diff --git a/sentry-openfeature/build.gradle.kts b/sentry-openfeature/build.gradle.kts index dfadca655bc..2554810ea11 100644 --- a/sentry-openfeature/build.gradle.kts +++ b/sentry-openfeature/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-quartz/build.gradle.kts b/sentry-quartz/build.gradle.kts index a970986ffcd..fc66a601e7e 100644 --- a/sentry-quartz/build.gradle.kts +++ b/sentry-quartz/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-reactor/build.gradle.kts b/sentry-reactor/build.gradle.kts index 449149d320f..c97fe51f752 100644 --- a/sentry-reactor/build.gradle.kts +++ b/sentry-reactor/build.gradle.kts @@ -19,8 +19,6 @@ tasks.named("compileJava") { options.release.set(17) } tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-samples/sentry-samples-spring-7/build.gradle.kts b/sentry-samples/sentry-samples-spring-7/build.gradle.kts index ef201480a52..8015bc80310 100644 --- a/sentry-samples/sentry-samples-spring-7/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-7/build.gradle.kts @@ -58,7 +58,5 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-log4j2/build.gradle.kts index 00bdefcdb1a..927a5c85cb0 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/build.gradle.kts @@ -22,8 +22,6 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts index ea8196b846e..e702d7764c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts @@ -22,8 +22,6 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index 90928af421f..bae33f4d263 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -23,8 +23,6 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts index 2a33a4bd46a..3805fa78b3e 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -22,8 +22,6 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts index 6a12eaadb5d..1b6865a91a5 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts @@ -41,7 +41,5 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index da74005836c..f14e170bfa2 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -22,8 +22,6 @@ tasks.withType().configureEach { // skip metadata version check, as Spring 7 / Spring Boot 4 is // compiled against a newer version of Kotlin compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } } diff --git a/sentry-servlet-jakarta/build.gradle.kts b/sentry-servlet-jakarta/build.gradle.kts index 1b4cac996f7..199fde4a2bd 100644 --- a/sentry-servlet-jakarta/build.gradle.kts +++ b/sentry-servlet-jakarta/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-servlet/build.gradle.kts b/sentry-servlet/build.gradle.kts index 18ebdb87f61..e654fb8dc11 100644 --- a/sentry-servlet/build.gradle.kts +++ b/sentry-servlet/build.gradle.kts @@ -16,8 +16,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-spring-7/build.gradle.kts b/sentry-spring-7/build.gradle.kts index 64c26019256..d106b736869 100644 --- a/sentry-spring-7/build.gradle.kts +++ b/sentry-spring-7/build.gradle.kts @@ -23,7 +23,6 @@ tasks.named("compileJava") { options.release.set(17) } tasks.named("compileKotlin") { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) - languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1) freeCompilerArgs.add("-Xjsr305=strict") } } diff --git a/sentry-spring-boot-4-starter/build.gradle.kts b/sentry-spring-boot-4-starter/build.gradle.kts index c3c5a4d7b0a..acdd9abab74 100644 --- a/sentry-spring-boot-4-starter/build.gradle.kts +++ b/sentry-spring-boot-4-starter/build.gradle.kts @@ -20,8 +20,6 @@ tasks.named("compileJava") { options.release.set(17) } tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-spring-boot-4/build.gradle.kts b/sentry-spring-boot-4/build.gradle.kts index e61e8c21053..f9e77a83a56 100644 --- a/sentry-spring-boot-4/build.gradle.kts +++ b/sentry-spring-boot-4/build.gradle.kts @@ -26,7 +26,6 @@ tasks.named("compileJava") { options.release.set(17) } tasks.named("compileKotlin") { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) - languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9) freeCompilerArgs.add("-Xjsr305=strict") } } diff --git a/sentry-spring-boot-jakarta/build.gradle.kts b/sentry-spring-boot-jakarta/build.gradle.kts index c9b68d7ce51..3a1d5f21734 100644 --- a/sentry-spring-boot-jakarta/build.gradle.kts +++ b/sentry-spring-boot-jakarta/build.gradle.kts @@ -24,8 +24,6 @@ tasks.named("compileJava") { options.release.set(17) } tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-spring-boot-starter-jakarta/build.gradle.kts b/sentry-spring-boot-starter-jakarta/build.gradle.kts index 61291a611d4..abec7c0b6bb 100644 --- a/sentry-spring-boot-starter-jakarta/build.gradle.kts +++ b/sentry-spring-boot-starter-jakarta/build.gradle.kts @@ -20,8 +20,6 @@ tasks.named("compileJava") { options.release.set(17) } tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-spring-boot-starter/build.gradle.kts b/sentry-spring-boot-starter/build.gradle.kts index 5d1228ab0b4..52b916a3651 100644 --- a/sentry-spring-boot-starter/build.gradle.kts +++ b/sentry-spring-boot-starter/build.gradle.kts @@ -15,8 +15,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-spring-boot/build.gradle.kts b/sentry-spring-boot/build.gradle.kts index 7325cbb2e7b..6eedacb92ce 100644 --- a/sentry-spring-boot/build.gradle.kts +++ b/sentry-spring-boot/build.gradle.kts @@ -20,8 +20,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } // Spring scans the integration test apps' own bytecode with its repackaged ASM at startup, and diff --git a/sentry-spring-jakarta/build.gradle.kts b/sentry-spring-jakarta/build.gradle.kts index 444d219f244..a427c22da3e 100644 --- a/sentry-spring-jakarta/build.gradle.kts +++ b/sentry-spring-jakarta/build.gradle.kts @@ -21,8 +21,6 @@ plugins { tasks.named("compileJava") { options.release.set(17) } kotlin { - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") } diff --git a/sentry-spring/build.gradle.kts b/sentry-spring/build.gradle.kts index 6c6c98b6a7d..2b7f1ac2dd8 100644 --- a/sentry-spring/build.gradle.kts +++ b/sentry-spring/build.gradle.kts @@ -18,8 +18,6 @@ plugins { tasks.named("compileKotlin") { compilerOptions.jvmTarget = JvmTarget.JVM_11 - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } dependencies { diff --git a/sentry-test-support/build.gradle.kts b/sentry-test-support/build.gradle.kts index b332f035958..b9118c801e5 100644 --- a/sentry-test-support/build.gradle.kts +++ b/sentry-test-support/build.gradle.kts @@ -8,11 +8,6 @@ plugins { id("io.sentry.jdk-target") } -tasks.withType().configureEach { - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 - compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 -} - dependencies { api(projects.sentry)