instance::class.java vs. instance.javaClass
The difference in these two constructs is that, for an expression foo of static (declared or inferred) type Foo: foo.javaClass is typed as Class<Foo> foo::class.java is typed as Class<out Foo> In fact, the latter is more precise, because the actual value that foo evaluates to can be an instance of not Foo itself but one … Read more