Annotation Processing
summary
Creates a compile‑time annotation processor (Java APT, run in a separate plain‑Java Gradle module) that generates BundleBinder classes for activities by scanning @BundleBind on classes and @BindValue on fields, writing string‑built or JavaPoet code via the filer and formatting with Google Java Format. Solves a real case of ~200 validated fields by avoiding reflection and runtime cost, supports rounds and incremental edits (rebuild regenerates code), and can block compilation for @InProgress classes by emitting messager errors. Registration uses META‑INF/services.
AI-written summary · about
chapters (13)
- 0:00Introduction to talk
- 1:27What are annotations
- 3:58Why write custom processors
- 8:14Benefits of code generation
- 13:08Annotation Processing Tool basics
- 16:47Demo setup and Gradle setup
- 26:07Live coding demo start
- 30:22Processor implementation
- 33:12Testing generated code
- 35:23Adding validation logic
- 37:09Renaming fields dynamically
- 38:14Creating in-progress annotation
- 43:00Q&A and closing remarks
related talks
36mAnnotation Processing 101
01h 03mJava Annotation Processing
30mYour own @Annotation processor
56mThe Wonders of Java Annotation Processing at Compile Time
46mJava annotation processing magic for muggles
45mExplaining annotation magic
50mRevealing the magic behind Java annotations
40mIntroduction to Bytecode Instrumentation with AGP 8
