I am trying to call java varargs method from kotlin code. Looks like the compiler accepts there only one parameter rather than a list of parameters or an array. Is this correct? How should I invoke such a method?
I have tried like this:
bean.javaClass.getMethod(“foo”, parameterTypes = Array<Class<Any?>>() )
This results in
Type mismatch: inferred type is kotlin.Array<java.lang.Class<kotlin.Any?>> but java.lang.Class<out kotlin.Any?> was expected
I can write like
bean.javaClass.getMethod(“foo”, javaClass<A>(), javaClass<B>(), javaClass<C>() )
And this works, but what I have to do is to get that method with dynamically generated argument type list.