[K/N] Mark kotlin.native.ref.Cleaner with @ExperimentalNativeApi

As a part of efforts to stabilize Native stdlib #KT-55765.
This commit is contained in:
Abduqodiri Qurbonzoda
2023-04-03 20:13:36 +03:00
committed by Space Team
parent 16078ae8e8
commit 0bd263b12a
2 changed files with 7 additions and 5 deletions
@@ -5,6 +5,7 @@
package kotlin.native.internal
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.concurrent.*
import kotlinx.cinterop.NativePtr
@@ -74,7 +75,7 @@ public interface Cleaner
@Suppress("DEPRECATION")
@ExperimentalStdlibApi
@ExportForCompiler
@OptIn(FreezingIsDeprecated::class)
@OptIn(ExperimentalNativeApi::class)
fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
kotlin.native.ref.createCleanerImpl(argument, block) as Cleaner
@@ -5,6 +5,7 @@
package kotlin.native.ref
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.concurrent.isShareable
import kotlin.native.concurrent.freeze
import kotlin.native.internal.*
@@ -15,7 +16,7 @@ import kotlinx.cinterop.NativePtr
*
* Use [createCleaner] to create an instance of this type.
*/
@ExperimentalStdlibApi
@ExperimentalNativeApi
@SinceKotlin("1.9")
public sealed interface Cleaner
@@ -83,13 +84,13 @@ public sealed interface Cleaner
*/
// TODO: Consider just annotating the lambda argument rather than hardcoding checking
// by function name in the compiler.
@ExperimentalStdlibApi
@ExperimentalNativeApi
@SinceKotlin("1.9")
@ExportForCompiler
public fun <T> createCleaner(resource: T, cleanupAction: (resource: T) -> Unit): Cleaner =
createCleanerImpl(resource, cleanupAction)
@ExperimentalStdlibApi
@ExperimentalNativeApi
@OptIn(FreezingIsDeprecated::class)
internal fun <T> createCleanerImpl(resource: T, cleanupAction: (T) -> Unit): Cleaner {
if (!resource.isShareable())
@@ -110,7 +111,7 @@ internal fun <T> createCleanerImpl(resource: T, cleanupAction: (T) -> Unit): Cle
}
@Suppress("DEPRECATION")
@ExperimentalStdlibApi
@ExperimentalNativeApi
@NoReorderFields
@ExportTypeInfo("theCleanerImplTypeInfo")
@HasFinalizer