Hey guys,
I'm starting with Kotlin and playing around with same data types.
While trying to implement a CyclicArray I got the problem to create an Array<E> or Array<E?>.
IntelliJ complains about the following code lineval buffer = Array<E?>(size=capacity, init={ i->null })
with the messageKotlin: Cannot use 'T' as reified type parameter. Use a class instead.
Here is some example code:
import java.util.*
class ExampleContainer<E>(val capacity: Int) {
val works = ArrayList<E?>()
val doesntWork = Array<E?>(size = capacity, init = { i -> null })
}
Although there is no T type element in the soure code the error message is as described above.
Thanks,
Dieter