Deprecate kotlin.jvm.internal.collectionToArray
This commit is contained in:
committed by
Space Team
parent
7fc90c02f1
commit
524df83265
@@ -14,6 +14,9 @@ import java.util.Arrays
|
||||
private val EMPTY = emptyArray<Any?>() // shared empty array
|
||||
private const val MAX_SIZE = Int.MAX_VALUE - 2 // empirically maximal array size that can be allocated without exceeding VM limits
|
||||
|
||||
// TODO: eventually should become internal @PublishedApi
|
||||
@Deprecated("This function will be made internal in a future release")
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@JvmName("toArray")
|
||||
fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
toArrayImpl(
|
||||
@@ -24,6 +27,9 @@ fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
)
|
||||
|
||||
// Note: Array<Any?> here can have any reference array JVM type at run time
|
||||
// TODO: eventually should become internal @PublishedApi
|
||||
@Deprecated("This function will be made internal in a future release")
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@JvmName("toArray")
|
||||
fun collectionToArray(collection: Collection<*>, a: Array<Any?>?): Array<Any?> {
|
||||
// Collection.toArray contract requires that NullPointerException is thrown when array is null
|
||||
|
||||
@@ -76,12 +76,13 @@ public actual fun <T> Iterable<T>.shuffled(): List<T> = toMutableList().apply {
|
||||
public fun <T> Iterable<T>.shuffled(random: java.util.Random): List<T> = toMutableList().apply { shuffle(random) }
|
||||
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@kotlin.internal.InlineOnly
|
||||
internal actual inline fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
kotlin.jvm.internal.collectionToArray(collection)
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST", "DEPRECATION")
|
||||
internal actual inline fun <T> collectionToArray(collection: Collection<*>, array: Array<T>): Array<T> =
|
||||
kotlin.jvm.internal.collectionToArray(collection, array as Array<Any?>) as Array<T>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user