Hi everyone, In Java, the `Class.isAssignableFrom(...
# kotlin-native
r
Hi everyone, In Java, the
Class.isAssignableFrom(Class<?> cls)
method checks if a class/interface is the same, a superclass, or a superinterface of another. Is there an equivalent way to achieve this in Kotlin/Native? Specifically, I want to check type relationships at runtime. Any suggestions? Thanks in advance!
🚫 1
e
KClass does not contain such information itself. on JVM it takes advantage of Java reflection, but that's JVM-only
you'll have to do something like https://github.com/JetBrains-Research/reflekt where you process all types and save their hierarchy at build time
r
thanks, I'll have a look!
e
note that Reflekt is not up to date with current versions of Kotlin; that's why I said "something like"
r
yeah I saw, the project seems abandoned (last commit 2 years ago and support up to Kotlin 1.7)