Generating Kotlin extension functions for Annotation Processing
summary
Proposes generating Kotlin extension functions as an extension bridge so generated annotation-processor code is accessible at compile time without Java reflection. Proof-of-concept libraries for Butter Knife and Dagger use a shipped endcap stub library (initially throwing) and KotlinPoet to emit a second, specific extension that replaces the stub so callers compile on first run. Works in demos but hits problems with static resolution and Java callers; a hybrid extension bridge adds reflection as a fallback.
AI-written summary · about
chapters (9)
- 0:00Start
- 3:26Dependency Injection Framework
- 6:26The Reflection Bridge
- 8:27The Extension Bridge Approach
- 11:12Proof-of-Concept Libraries for the Tool Libraries
- 17:08Static Resolution
- 18:35Java Interoperability
- 20:26The Hybrid Extension Bridge
- 21:16Questions
related talks
44mExploiting Kotlin Metadata + Annotation Processing
41mAnnotation Processing in a Kotlin World
36mFact or kapt? Build your next annotation processor with KSP
39mAnnotation processing for Kotlin done right
13mLevel Up Your Extension Game
30mExtending kotlin-inject for fun & profit
15mOn the Applicability of Annotation-Based Source Code Modification in Kotlin (Work...
26mBuild your own compiler with KSP
