Skip to content

Commit bea82ba

Browse files
committed
[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
1 parent 4de6fd8 commit bea82ba

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt

+14
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ public typealias ThreadLocal = kotlin.native.concurrent.ThreadLocal
5858
/** @suppress */
5959
public typealias SharedImmutable = kotlin.native.concurrent.SharedImmutable
6060

61+
/**
62+
* Forces a top-level property to be initialized eagerly, opposed to lazily on the first access to file and/or property.
63+
* This annotation can be used as temporal migration assistance during the transition from the previous Kotlin/Native initialization scheme "eager by default"
64+
* to the new one, "lazy by default".
65+
*
66+
* 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.
67+
* 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.
68+
*/
69+
@Target(AnnotationTarget.PROPERTY)
70+
@Retention(AnnotationRetention.BINARY)
71+
@ExperimentalStdlibApi
72+
@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")
73+
public annotation class EagerInitialization
74+
6175
/**
6276
* Makes top level function available from C/C++ code with the given name.
6377
*

0 commit comments

Comments
 (0)