Move array constructors to builtins module back to kotlin package.

This commit is contained in:
Ilya Gorbunov
2015-12-04 23:46:26 +03:00
parent 5aff07561d
commit f509937037
4 changed files with 116 additions and 0 deletions
@@ -10,6 +10,7 @@ import java.util.*
* Returns an array with the specified [size], where each element is calculated by calling the specified
* [init] function. The `init` function returns an array element given its index.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <reified T> Array(size: Int, init: (Int) -> T): Array<T> {
val result = arrayOfNulls<T>(size)
@@ -23,6 +24,7 @@ public inline fun <reified T> Array(size: Int, init: (Int) -> T): Array<T> {
/**
* Returns an empty array of the specified type [T].
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <reified T> emptyArray(): Array<T> = arrayOfNulls<T>(0) as Array<T>
/**
@@ -10,47 +10,56 @@ import java.nio.charset.Charset
/**
* Returns an array containing the specified elements.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public inline fun <reified T> arrayOf(vararg elements: T) : Array<T> = elements as Array<T>
// "constructors" for primitive types array
/**
* Returns an array containing the specified [Double] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun doubleArrayOf(vararg elements: Double) : DoubleArray = elements
/**
* Returns an array containing the specified [Float] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun floatArrayOf(vararg elements: Float) : FloatArray = elements
/**
* Returns an array containing the specified [Long] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun longArrayOf(vararg elements: Long) : LongArray = elements
/**
* Returns an array containing the specified [Int] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun intArrayOf(vararg elements: Int) : IntArray = elements
/**
* Returns an array containing the specified characters.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun charArrayOf(vararg elements: Char) : CharArray = elements
/**
* Returns an array containing the specified [Short] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun shortArrayOf(vararg elements: Short) : ShortArray = elements
/**
* Returns an array containing the specified [Byte] numbers.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun byteArrayOf(vararg elements: Byte) : ByteArray = elements
/**
* Returns an array containing the specified boolean values.
*/
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
public fun booleanArrayOf(vararg elements: Boolean) : BooleanArray = elements
/**