Skip to content

rnett/inspekt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stability: ALPHA Maven Central Version Maven snapshots Documentation GitHub License

Inspekt

100% multiplatform, 100% compile time reflection for Kotlin. Includes:

  • Inspecting classes, functions, and properties
  • Top-level declaration support
  • Annotation instances
  • Function invocation, including suspend functions
  • is checking and casting
  • JVM-like proxies
  • Reflecting over dependencies (whether they use Inspekt or not)
  • Seamless reflection over Java classes
  • GraalVM compatible out of the box (I think, it's not tested yet)

Getting started

To 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 @Composable functions.

Documentation

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.

Stability

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.

Examples

Some basic examples are located in the examples directory.

About

Compile time, multiplatform reflection for Kotlin

Topics

Resources

License

Stars

Watchers

Forks

Contributors