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
+2
View File
@@ -114,6 +114,8 @@ public inline fun error(message: kotlin.Any): kotlin.Nothing
/*∆*/
public fun <T> lazy(initializer: () -> T): kotlin.Lazy<T>
@kotlin.Deprecated(message = "Synchronization on Any? object is not supported.", replaceWith = kotlin.ReplaceWith(expression = "lazy(initializer)", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.9")
public fun <T> lazy(lock: kotlin.Any?, initializer: () -> T): kotlin.Lazy<T>
public fun <T> lazy(mode: kotlin.LazyThreadSafetyMode, initializer: () -> T): kotlin.Lazy<T>
+2
View File
@@ -84,6 +84,8 @@ public inline fun error(message: kotlin.Any): kotlin.Nothing
public fun <T> lazy(initializer: () -> T): kotlin.Lazy<T>
@kotlin.Deprecated(message = "Synchronization on Any? object is not supported.", replaceWith = kotlin.ReplaceWith(expression = "lazy(initializer)", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.9")
public fun <T> lazy(lock: kotlin.Any?, initializer: () -> T): kotlin.Lazy<T>
public fun <T> lazy(mode: kotlin.LazyThreadSafetyMode, initializer: () -> T): kotlin.Lazy<T>
@@ -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>
@@ -33,6 +33,8 @@ public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): La
*
* The [lock] parameter is ignored.
*/
@Deprecated("Synchronization on Any? object is not supported.", ReplaceWith("lazy(initializer)"))
@DeprecatedSinceKotlin(warningSince = "1.9")
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
@@ -55,6 +55,8 @@ public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): La
*
* The [lock] parameter is ignored.
*/
@Deprecated("Synchronization on Any? object is not supported.", ReplaceWith("lazy(initializer)"))
@DeprecatedSinceKotlin(warningSince = "1.9")
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
+2
View File
@@ -21,4 +21,6 @@ public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): La
*
* The [lock] parameter is ignored.
*/
@Deprecated("Synchronization on Any? object is not supported.", ReplaceWith("lazy(initializer)"))
@DeprecatedSinceKotlin(warningSince = "1.9")
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)