Array.copyOf may produce nulls

This commit is contained in:
Stepan Koltsov
2012-05-17 16:37:00 +04:00
parent 108dd156af
commit 942777205c
+2
View File
@@ -88,6 +88,7 @@ public inline fun FloatArray.copyOf(newLength: Int = this.size) : FloatArray
public inline fun DoubleArray.copyOf(newLength: Int = this.size) : DoubleArray = Arrays.copyOf(this, newLength).sure()
public inline fun CharArray.copyOf(newLength: Int = this.size) : CharArray = Arrays.copyOf(this, newLength).sure()
// TODO: resuling array may contain nulls even if T is non-nullable
public inline fun <T> Array<T>.copyOf(newLength: Int = this.size) : Array<T> = Arrays.copyOf(this as Array<T?>, newLength) as Array<T>
public inline fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray = Arrays.copyOfRange(this, from, to).sure()
@@ -99,6 +100,7 @@ public inline fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray =
public inline fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray = Arrays.copyOfRange(this, from, to).sure()
public inline fun CharArray.copyOfRange(from: Int, to: Int) : CharArray = Arrays.copyOfRange(this, from, to).sure()
// TODO: resuling array may contain nulls even if T is non-nullable
public inline fun <T> Array<T>.copyOfRange(from: Int, to: Int) : Array<T> = Arrays.copyOfRange(this as Array<T?>, from, to) as Array<T>
public inline val ByteArray.inputStream : ByteArrayInputStream