From bea82ba2cd54db113acbbd9e257fd897b589a0c9 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Thu, 15 Jul 2021 15:24:19 +0500 Subject: [PATCH] [K/N][stdlib] Added @EagerInitialization annotation It is needed in the lazy top level properties initialization strategy to revert to the previous strategy at least for the transition period --- .../src/main/kotlin/kotlin/native/Annotations.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt index f3d5e6f6ab8..c2efe249dcc 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt @@ -58,6 +58,20 @@ public typealias ThreadLocal = kotlin.native.concurrent.ThreadLocal /** @suppress */ public typealias SharedImmutable = kotlin.native.concurrent.SharedImmutable +/** + * Forces a top-level property to be initialized eagerly, opposed to lazily on the first access to file and/or property. + * This annotation can be used as temporal migration assistance during the transition from the previous Kotlin/Native initialization scheme "eager by default" + * to the new one, "lazy by default". + * + * This annotation is intended to be used only as a temporal workaround and will be removed through the regular deprecation cycle as soon as the new initialization scheme will become the default one. + * For the usages that cannot be emulated on the new initialization scheme without this annotation, it is strongly recommended to report them during the transition period, so the proper replacement can be introduced. + */ +@Target(AnnotationTarget.PROPERTY) +@Retention(AnnotationRetention.BINARY) +@ExperimentalStdlibApi +@Deprecated("This annotation is a temporal migration assistance and may be removed in the future releases, please consider filing an issue about the case where it is needed") +public annotation class EagerInitialization + /** * Makes top level function available from C/C++ code with the given name. *