What is the Kotlin equivalent of Java's MyClass.class?


#1

I want to get the Class object for a given Class, in Java I'd use the .class static field - how can I do this in Kotlin?

I would guess that I would use the typeinfo() method, however this doesn’t seem to have been implemented yet :-/


#2

You can use javaClass<MyClass>


#3

I use this with junit where I would say NullPointerException.class in Java:  Class<NullPointerException>


#4

Thanks!