Do not fail with type cast when not needed in reflection.jvm
This commit is contained in:
@@ -53,7 +53,7 @@ public var KCallable<*>.isAccessible: Boolean
|
|||||||
javaMethod?.isAccessible ?: true
|
javaMethod?.isAccessible ?: true
|
||||||
is KFunction ->
|
is KFunction ->
|
||||||
javaMethod?.isAccessible ?: true &&
|
javaMethod?.isAccessible ?: true &&
|
||||||
((this as KCallableImpl<*>).defaultCaller?.member as? AccessibleObject)?.isAccessible ?: true &&
|
((this as? KCallableImpl<*>)?.defaultCaller?.member as? AccessibleObject)?.isAccessible ?: true &&
|
||||||
this.javaConstructor?.isAccessible ?: true
|
this.javaConstructor?.isAccessible ?: true
|
||||||
else -> throw UnsupportedOperationException("Unknown callable: $this ($javaClass)")
|
else -> throw UnsupportedOperationException("Unknown callable: $this ($javaClass)")
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ public var KCallable<*>.isAccessible: Boolean
|
|||||||
}
|
}
|
||||||
is KFunction -> {
|
is KFunction -> {
|
||||||
javaMethod?.isAccessible = value
|
javaMethod?.isAccessible = value
|
||||||
((this as KCallableImpl<*>).defaultCaller?.member as? AccessibleObject)?.isAccessible = true
|
((this as? KCallableImpl<*>)?.defaultCaller?.member as? AccessibleObject)?.isAccessible = true
|
||||||
this.javaConstructor?.isAccessible = value
|
this.javaConstructor?.isAccessible = value
|
||||||
}
|
}
|
||||||
else -> throw UnsupportedOperationException("Unknown callable: $this ($javaClass)")
|
else -> throw UnsupportedOperationException("Unknown callable: $this ($javaClass)")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import kotlin.reflect.jvm.internal.KTypeImpl
|
|||||||
* or `null` if the property has no backing field.
|
* or `null` if the property has no backing field.
|
||||||
*/
|
*/
|
||||||
public val KProperty<*>.javaField: Field?
|
public val KProperty<*>.javaField: Field?
|
||||||
get() = (this as KPropertyImpl<*>).javaField
|
get() = (this as? KPropertyImpl<*>)?.javaField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Java [Method] instance corresponding to the getter of the given property,
|
* Returns a Java [Method] instance corresponding to the getter of the given property,
|
||||||
|
|||||||
Reference in New Issue
Block a user