Catch NoSuchFieldException
This commit is contained in:
@@ -97,13 +97,18 @@ public val KType.javaType: Type
|
|||||||
public val Class<*>.kotlinPackage: KPackage?
|
public val Class<*>.kotlinPackage: KPackage?
|
||||||
get() = if (getSimpleName().endsWith("Package") &&
|
get() = if (getSimpleName().endsWith("Package") &&
|
||||||
getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) {
|
getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) {
|
||||||
val field = this.getField(JvmAbi.KOTLIN_MODULE_FIELD_NAME)
|
try {
|
||||||
if (field != null) {
|
val field = this.getField(JvmAbi.KOTLIN_MODULE_FIELD_NAME)
|
||||||
KPackageImpl(this, field.get(null) as String)
|
if (field != null) {
|
||||||
} else {
|
KPackageImpl(this, field.get(null) as String)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e: NoSuchFieldException) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
} else null
|
} else null
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user