```class ArrayBuilder { @Suppress("UNCHECKED_C...
# random
a
Copy code
class ArrayBuilder {
    @Suppress("UNCHECKED_CAST")
	operator inline fun<reified T> get(vararg items:T):Array<T> = items as Array<T>
}
val array = ArrayBuilder()

fun darkMagic() {
	array[1,2,3]
}
­čść 1
(updated from
= arrayOf(*items)
to
= items
)
(updated from
:Array<out T> = items
to
:Array<T> = items as Array<T>
with
@Suppress
)
To remove
GETSTATIC array : LArrayBuilder;
:
Copy code
class ArrayBuilder private constructor() {
}
@Suppress("UNCHECKED_CAST")
operator inline fun<reified T> ArrayBuilder?.get(vararg items:T):Array<T> = items as Array<T>
inline val array:ArrayBuilder? get() = null

fun darkMagic() {
	val a: Array<out Int> = array[1,2,3]
	val b = arrayOf(1,2,3)
}
However that^ implementation makes
null[1,2,3]
possible
Copy code
inline operator fun<reified T> Array.Companion.get(vararg items:T): Array<T> = items as Array<T>

val a = Array["1", "2", "3"]