if i have a variable `clazz` that is a `KClassImpl...
# android
l
if i have a variable
clazz
that is a
KClassImpl
how would i check if that is of type
FooBar
i tried this
clazz.java.isInstance(FooBar::class.java)
but that always returns false
t
That's not the correct method of
Class
:
isInstance
checks that the parameter is an instance of that class, which is always false for an instance of
Class<FooBar>
You need to use
clazz.java.isAssignableFrom(FooBar::class.java)
instead.