On the Applicability of Annotation-Based Source Code Modification in Kotlin (Work...
summary
Compares four concrete approaches—KAPT (legacy), KSP, custom compiler plugins, and load‑time agents—and provides proof‑of‑concept implementations on GitHub: a compiler plugin that injects IR nodes into function bodies and a Java agent that rewrites bytecode. Finds KSP: code generation only, no expression‑level analysis, about twice as fast as KAPT and multiplatform; compiler plugin: IR‑level modification across targets but very complex and poorly documented; KAPT is slow/maintenance mode; agents work on JVM only and increase startup time.
AI-written summary · about
chapters (7)
- 0:00Annotation-based code modification
- 2:09KSP for annotation processing
- 4:37Compiler plugins for code
- 7:52Load-time bytecode approaches
- 9:17Annotation processing comparison
- 10:40Key takeaways and future work
- 11:45Q&A
related talks
38mKSP and Plugins. Optimizing Kotlin Multiplatform common code
33mMeta-programming with KSP and Kotlin compiler plugins
44mMeta-programming with KSP and Kotlin compiler plugins
47mDealing With KSP in Common Code for Android and iOS
36mFact or kapt? Build your next annotation processor with KSP
26mBuild your own compiler with KSP
37mWhy you should positively consider introducing and migrating to KSP
28mMetaprogramming with Kotlin Symbol Processing
