
Compile-time reflection enabling inspection of classes, functions, properties and annotations, with top-level declaration support, suspend invocation, JVM-like proxies and dependency reflection.
100% multiplatform, 100% compile time reflection for Kotlin. Includes:
suspend functionsis checking and castingTo use Inspekt, just apply the Gradle plugin:
plugins {
id("dev.rnett.inspekt") version "<version>" // see the Maven Central badge above
}and call inspekt from your code:
val fooClass = inspekt(Foo::class)
foo.function("bar").invoke {
dispatchReceiver = Foo()
}[!WARNING] Compatibility with other compiler plugins depends on the plugin and is not at all guaranteed or even expected to work. Use at your own risk. It will most likely work for declarations generated by other plugins if you use the compiler plugin ordering parameter to ensure Inspekt (which has id
dev.rnett.inspekt.compiler-plugin) runs after the other plugin(s).It is 0% compatible with
@Composablefunctions.
More detailed documentation is available at https://inspekt.rnett.dev/latest/.
Snapshot version docs are available at https://inspekt.rnett.dev/snapshot/, if there is currently a next-version snapshot build.
This library has been initially released as alpha because it depends on a number of compiler internals. However, I plan no significant changes and will strive to avoid any backwards incompatible changes.
Some basic examples are located in the examples directory.
100% multiplatform, 100% compile time reflection for Kotlin. Includes:
suspend functionsis checking and castingTo use Inspekt, just apply the Gradle plugin:
plugins {
id("dev.rnett.inspekt") version "<version>" // see the Maven Central badge above
}and call inspekt from your code:
val fooClass = inspekt(Foo::class)
foo.function("bar").invoke {
dispatchReceiver = Foo()
}[!WARNING] Compatibility with other compiler plugins depends on the plugin and is not at all guaranteed or even expected to work. Use at your own risk. It will most likely work for declarations generated by other plugins if you use the compiler plugin ordering parameter to ensure Inspekt (which has id
dev.rnett.inspekt.compiler-plugin) runs after the other plugin(s).It is 0% compatible with
@Composablefunctions.
More detailed documentation is available at https://inspekt.rnett.dev/latest/.
Snapshot version docs are available at https://inspekt.rnett.dev/snapshot/, if there is currently a next-version snapshot build.
This library has been initially released as alpha because it depends on a number of compiler internals. However, I plan no significant changes and will strive to avoid any backwards incompatible changes.
Some basic examples are located in the examples directory.