~/talk

Reflection is Dead, Long Live Annotation Processing!

Talkat XtremeJ 2024 · on Tuesday, 2024-11-05· [java, compilers-and-language-design]
links:none on file
slides:none on file

Reflection is slow and brittle for wiring and mass instantiation, so compile-time annotation processing generates concrete code instead: a custom @Fact annotation plus a JSR 269 processor that writes Java source produces a CourseFactory class at compile time. Measured differences: reflection instantiation = 20ms vs direct 3ms, Spring startup hitting ~0.5s bare and 3.5s with services (sometimes 10–20s). Tooling uses javac with -processor, META-INF/services, manual string-based source generation (JavaPoet optional), and the generated factory works but requires adjusting the build classpath.

AI-written summary · about

  1. 0:00Introduction to meta-programming
  2. 1:28Abstraction and its limits
  3. 6:04Reflection limitations and performance
  4. 10:48Runtime vs compile-time meta-programming
  5. 12:12What is annotation processing
  6. 15:43Annotation processor basics
  7. 16:51Factory pattern with annotation processing
  8. 22:18Compiling and packaging the processor
  9. 23:53Using the annotation processor
  10. 26:38Q&A and closing remarks
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.