Mark all Worker-related API as obsolete.

* Explain what obsolete means and why workers are obsolete
* Add some documentation to workers to explain its common pitfalls

^KT-54702


Merge-request: KT-MR-9563
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
This commit is contained in:
Vsevolod Tolstopyatov
2023-04-19 09:28:23 +00:00
committed by Space Team
parent ec4fab57a7
commit af9252aa96
59 changed files with 174 additions and 68 deletions
@@ -2,7 +2,7 @@
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(ExperimentalStdlibApi::class, kotlin.native.runtime.NativeRuntimeApi::class)
@file:OptIn(ExperimentalStdlibApi::class, kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
import kotlin.test.*
@@ -2,7 +2,7 @@
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class, kotlin.experimental.ExperimentalNativeApi::class, kotlin.native.runtime.NativeRuntimeApi::class)
@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class, kotlin.experimental.ExperimentalNativeApi::class, kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
package runtime.basic.cleaner_workers
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.basic.initializers6
import kotlin.test.*
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.basic.worker_random
import kotlin.native.concurrent.*
@@ -39,4 +40,4 @@ fun testRandomWorkers() {
workers.forEach {
it.requestTermination().result
}
}
}
@@ -2,7 +2,7 @@
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class, kotlin.native.runtime.NativeRuntimeApi::class)
@file:OptIn(FreezingIsDeprecated::class, kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
package runtime.concurrent.worker_bound_reference0
@@ -2,7 +2,7 @@
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.memory.stable_ref_cross_thread_check
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.atomic0
import kotlin.test.*
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.workers.enum_identity
import kotlin.test.*
@@ -21,4 +22,4 @@ fun runTest() {
input.kind == A.B
}).result
println(result)
}
}
@@ -2,7 +2,7 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.freeze0
@@ -30,4 +30,4 @@ data class SharedData(val string: String, val int: Int, val member: SharedDataMe
}
worker.requestTermination().result
println("OK")
}
}
@@ -2,7 +2,7 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.freeze2
@@ -2,7 +2,7 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.freeze3
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.lazy0
import kotlin.test.*
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.lazy4
import kotlin.test.*
@@ -1,3 +1,4 @@
@file:OptIn(ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
import kotlin.native.Platform
import kotlinx.cinterop.*
@@ -1,3 +1,4 @@
@file:OptIn(ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
import kotlin.native.Platform
import kotlinx.cinterop.*
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.mutableData1
import kotlin.native.concurrent.*
@@ -45,4 +45,4 @@ private fun assertContentsEquals(expected: ByteArray, actual: MutableData) {
expected.forEachIndexed { index, byte ->
assertEquals(byte, actual.get(index))
}
}
}
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.workers.worker0
import kotlin.test.*
@@ -22,4 +23,4 @@ import kotlin.native.concurrent.*
}
worker.requestTermination().result
println("OK")
}
}
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.workers.worker1
import kotlin.test.*
@@ -32,4 +33,4 @@ import kotlin.native.concurrent.*
it.requestTermination().result
}
println("OK")
}
}
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class, kotlin.experimental.ExperimentalNativeApi::class, kotlin.native.runtime.NativeRuntimeApi::class)
@file:OptIn(FreezingIsDeprecated::class, kotlin.experimental.ExperimentalNativeApi::class, kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
package runtime.workers.worker10
import kotlin.test.*
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker11
import kotlin.test.*
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.workers.worker2
import kotlin.test.*
@@ -42,4 +43,4 @@ data class WorkerResult(val intResult: Int, val stringResult: String)
it.requestTermination().result
}
println("OK")
}
}
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.workers.worker3
import kotlin.test.*
@@ -33,4 +34,4 @@ fun main(args: Array<String>) {
if (dataParam.int != 17) println("Fail 2")
worker.requestTermination().result
println("OK")
}
}
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker4
import kotlin.test.*
@@ -2,7 +2,7 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
import kotlin.test.*
@@ -50,4 +50,4 @@ fun main() {
runTest0()
runTest1()
runTest2()
}
}
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker6
import kotlin.test.*
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
package runtime.workers.worker7
import kotlin.test.*
@@ -25,4 +26,4 @@ import kotlin.native.concurrent.*
worker.requestTermination().result
println("OK")
}
}
@@ -2,7 +2,7 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker8
@@ -30,4 +30,4 @@ data class SharedData(val string: String, val int: Int, val member: SharedDataMe
}
worker.requestTermination().result
println("OK")
}
}
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker9
import kotlin.test.*
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker9_experimentalMM
import kotlin.test.*
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker_exception_messages
import kotlin.test.*
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker_exceptions
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker_exceptions_legacy
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class, ExperimentalStdlibApi::class)
@file:OptIn(FreezingIsDeprecated::class, ExperimentalStdlibApi::class, ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
@@ -1,4 +1,4 @@
@file:OptIn(FreezingIsDeprecated::class, ExperimentalStdlibApi::class)
@file:OptIn(FreezingIsDeprecated::class, ExperimentalStdlibApi::class, ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
@@ -1,4 +1,4 @@
@file:OptIn(kotlin.ExperimentalStdlibApi::class)
@file:OptIn(kotlin.ExperimentalStdlibApi::class, ObsoleteWorkersApi::class)
package runtime.workers.worker_list_workers
@@ -3,6 +3,7 @@
* that can be found in the LICENSE file.
*/
@file:OptIn(ObsoleteWorkersApi::class)
import kotlin.native.concurrent.*
import kotlin.native.Platform