fixup! Promote public constructor deprecations to errors
diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTest.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTest.kt
index 6b0e759..4836687 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTest.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTest.kt
@@ -21,6 +21,7 @@
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutionSpec
import org.jetbrains.kotlin.gradle.targets.native.internal.NativeAppleSimulatorTCServiceMessagesTestExecutionSpec
import org.jetbrains.kotlin.gradle.targets.native.internal.parseKotlinNativeStackTraceAsJvm
+import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
import org.jetbrains.kotlin.gradle.tasks.KotlinTest
import org.jetbrains.kotlin.gradle.utils.SystemGetEnvSource.Companion.getAllEnvironmentVariables
import org.jetbrains.kotlin.gradle.utils.getExecOperations
@@ -35,6 +36,8 @@
internal constructor(
createdWithPublicConstructor: ObjectFactory?,
) : KotlinTest(createdWithPublicConstructor) {
+ @Deprecated(message = "Extending this class is deprecated. Scheduled for removal in Kotlin 2.4.", level = DeprecationLevel.ERROR)
+ constructor() : this(null)
private val providers: ProviderFactory = project.providers
@@ -218,6 +221,9 @@
) : KotlinNativeTest(
createdWithPublicConstructor
) {
+ @Deprecated(message = "Extending this class is deprecated. Scheduled for removal in Kotlin 2.4.", level = DeprecationLevel.ERROR)
+ constructor() : this(null)
+
@get:Internal
override val testCommand: TestCommand = object : TestCommand() {
override val executable: String
@@ -244,6 +250,8 @@
) : KotlinNativeTest(
createdWithPublicConstructor
) {
+ @Deprecated(message = "Extending this class is deprecated. Scheduled for removal in Kotlin 2.4.", level = DeprecationLevel.ERROR)
+ constructor() : this(null)
@Deprecated("Use the property 'device' instead. Scheduled for removal in Kotlin 2.3.", level = DeprecationLevel.ERROR)
@get:Internal
diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/KT75869DeprecatedConstructors.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/KT75869DeprecatedConstructors.kt
new file mode 100644
index 0000000..ba8453f
--- /dev/null
+++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/KT75869DeprecatedConstructors.kt
@@ -0,0 +1,38 @@
+package org.jetbrains.kotlin.gradle.unitTests
+
+import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
+import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
+import org.jetbrains.kotlin.gradle.util.assertContains
+import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP
+import org.jetbrains.kotlin.gradle.util.kotlin
+import org.junit.Test
+import javax.inject.Inject
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+
+class KT75869DeprecatedConstructors {
+
+ @Test
+ fun testDeprecatedConstructorsThrowConfigurationTimeError() {
+ val subclassedJsTest = runCatching {
+ buildProjectWithMPP {
+ @Suppress("DEPRECATION_ERROR")
+ abstract class JsTestSubclass @Inject constructor(compilation: KotlinJsIrCompilation) : KotlinJsTest(compilation)
+
+ kotlin {
+ tasks.register(
+ "foo",
+ JsTestSubclass::class.java,
+ js().compilations.getByName("main")
+ ).get()
+ }
+ }
+ }
+ val subclassingError = assertNotNull(subclassedJsTest.exceptionOrNull()?.stackTraceToString())
+ assertContains(
+ $$"Cannot create instance of org.jetbrains.kotlin.gradle.unitTests.KT75869DeprecatedConstructors$testDeprecatedConstructorsThrowConfigurationTimeError$subclassedJsTest$1$1$JsTestSubclass. Constructor is deprecated, see Kdoc for details.",
+ subclassingError,
+ )
+ }
+}
\ No newline at end of file