Skip to content

kosi-libs/Kaverit

Repository files navigation

Kaverit

A light multiplatform Kotlin reflection API.

  • erased generates a TypeToken that represents a type without its (optional) generic parameters, constructed at compile-time (no run-time reflection overhead).
  • generic generates a TypeToken that represents a type with its generic parameters, constructed at compile-time (with reflection).
  • erasedComp generates a TypeToken that represents a type with its generic parameters, constructed at run-time (with explicit parameters: no run-time overhead but verbose syntax).

All TypeTokens are comparable between them:

erased<String>() == generic<String>()

erased<List<*>>() == generic<List<*>>()

generic<List<String>>() == erasedComp<List<String>>(List::class, String::class)