i think i’ve found a bug in kotlin converter, Java...
# announcements
n
i think i’ve found a bug in kotlin converter, Java Code
Copy code
Collection<Long> values = fetchList();
            Long[] valuesAsArray = new Long[values.size()];
            values.toArray(valuesAsArray);
Kotlin conversion
Copy code
val values = fetchList()
            val valuesAsArray = arrayOfNulls<Long>(values.size)
            values.toTypedArray()
and all elements in valuesAsArray will be null
l
I think there's no bug. Typed arrays of non primitives have null values by default in java
n
the bug is that valuesAsArray in java had the data
in kotlin it contains just nulls
m
Java Code and Kotlin Code are different, aren’t they?
n
yes and that’s the problem. i have converted using intellij java to kotlin converter
m
In third line
Ah.. So you mean Idea conversion tool..
n
kotlin code should be
Copy code
val values = fetchList()
val valuesAsArray = values.toTypedArray()
yes
k
youtrack
n