Let's say I have a Java method: `<T> T doSom...
# announcements
j
Let's say I have a Java method:
<T> T doSomething(Class<T> type)
and I want to pass a type that is an array of Class (or an array of any other generic type). I can use a raw type and do
doSomething(Class[].class)
in Java. But calling from Kotlin, I can't do
doSomething(Array<Class<*>>::class.java)
or
doSomething(Array<Class<Any>>::class.java)
or
doSomething(Array<Class>::class.java)
Output is:
Kotlin: Only classes are allowed on the left hand side of a class literal
which makes sense to me, but I don't control the underlying library. Any ideas on how I can call that Java method? It's a hot code path so avoiding allocation ideally.