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
@@ -56,4 +56,6 @@ public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): La
* Also this behavior can be changed in the future.
*/
@Suppress("UNUSED_PARAMETER")
@Deprecated("Synchronization on Any? object is not supported.", ReplaceWith("lazy(initializer)"))
@DeprecatedSinceKotlin(errorSince = "1.9")
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = throw UnsupportedOperationException()