org.jetbrains.kotlinx.jupyter.util.Reflecton.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-jupyter-api Show documentation
Show all versions of kotlin-jupyter-api Show documentation
API for libraries supporting Kotlin Jupyter notebooks
package org.jetbrains.kotlinx.jupyter.util
import kotlin.reflect.KClass
import kotlin.reflect.full.isSubclassOf
import kotlin.reflect.jvm.internal.KotlinReflectionInternalError
fun KClass<*>.isSubclassOfCatching(superType: KClass<*>): Boolean {
return try {
isSubclassOf(superType)
} catch (e: UnsupportedOperationException) {
false
} catch (e: KotlinReflectionInternalError) {
false
} catch (e: InternalError) {
// Workaround for #341
false
}
}