We break down a practical alternative to
runtime reflection in Kotlin: how an annotation (for example,
@CliCommand) becomes input data for
KSP, how
.kt files are generated at compile time, and why the end result is a fast, predictable runtime without “magic” lookups. Using a CLI example, we show the pipeline “annotation → generation → regular code”, discuss pros/cons, selection criteria, and common generation design mistakes.