Codegen with KSP: A Farewell to Stubs

Kotlin Symbol Processor (KSP) is a new tool from Google that promises strong improvements over legacy javax.lang.model processors that run with kapt. These are slow because they require generation of Java stubs for your Kotlin code.

Say “farewell” to stubs and the resulting slow builds by using KSP in your Android project. After explaining the need for annotation processors and metaprogramming for handling cross-cutting concerns, we will build and test a toy annotation processor live on screen. This will give you the confidence to attempt more complex KSP codegen in your Android app.

For projects with legacy processors that can’t be rewritten, we will cover Google’s X-Processing library that has been used in Room and Epoxy. Finally we will address performance concerns by explaining how to make processors incremental using aggregating and isolating modes.



Close Menu