Package kotlin.reflect.jvm
Runtime API for interoperability between Kotlin reflection and
Java reflection provided by kotlin-reflect
library.
Annotations
ExperimentalReflectionOnLambdas
This annotation marks the experimental kotlin-reflect API that allows to approximate a Kotlin lambda or a function expression instance to a KFunction instance. The behavior of this API may be changed or the API may be removed completely in any further release.
annotation class ExperimentalReflectionOnLambdas
Extensions for External Classes
Properties
isAccessible
Provides a way to suppress JVM access checks for a callable.
var KCallable<*>.isAccessible: Boolean
javaConstructor
Returns a Java Constructor instance corresponding to the given Kotlin function,
or null
if this function is not a constructor or cannot be represented by a Java Constructor.
val <T> KFunction<T>.javaConstructor: Constructor<T>?
javaSetter
Returns a Java Method instance corresponding to the setter of the given mutable property,
or null
if the property has no setter, for example in case of a simple private var
in a class.
val KMutableProperty<*>.javaSetter: Method?
javaType
Returns a Java Type instance corresponding to the given Kotlin type.
Note that one Kotlin type may correspond to different JVM types depending on where it appears. For example, Unit corresponds to
the JVM class Unit when it's the type of a parameter, or to void
when it's the return type of a function.
Functions
reflect
This is an experimental API. Given a class for a compiled Kotlin lambda or a function expression, returns a KFunction instance providing introspection capabilities for that lambda or function expression and its parameters. Not all features are currently supported, in particular KCallable.call and KCallable.callBy will fail at the moment.