Deprecate lazy() that synchronizes on a given lock in non-JVM platforms

Because the overload has a meaningful implementation only in JVM.
In other platforms the specified lock object is ignored.
In K/N it throws UnsupportedOperationException.
This commit is contained in:
Abduqodiri Qurbonzoda
2023-05-29 16:49:23 +03:00
committed by Space Team
parent 9864402cf8
commit 7d9ea28604
7 changed files with 14 additions and 0 deletions
@@ -73,4 +73,6 @@ public expect fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): La
*
* The [lock] parameter is ignored.
*/
@Deprecated("Synchronization on Any? object is supported only in Kotlin/JVM.", ReplaceWith("lazy(initializer)"))
@DeprecatedSinceKotlin(warningSince = "1.9")
public expect fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>