https://kotlinlang.org logo
Title
f

Florian

09/23/2019, 5:06 PM
I can't overload a
vararg
function with an
Array
of the same type because the vararg is internally represented as an array on the JVM? (I know I can use the spread operator)
k

karelpeeters

09/23/2019, 8:00 PM
Yes, as a workaround you could maybe use
@JvmName
, but don't.
f

Florian

09/23/2019, 8:12 PM
thanks
is it impossible to pass a (spreaded)
Array<Int>
to
varargs x: Int
?
seems like it only accepts
IntArray
are there no use cases for varargs of box types?
I guess it doesnt matter since you can always convert it
k

karelpeeters

09/23/2019, 8:25 PM
I think it has to do with Java compatibility, where
int...
is
int[]
and not
Integer[]
. But like you said, it's not a big problem.
f

Florian

09/23/2019, 9:38 PM
yea seems like it always has to be converted to IntArray