~/talk

Understanding Dagger 2's Codegen implementation

Talkat Devoxx US 2017 · 2017-03-21..03-23· [java, compilers-and-language-design]
links:none on file
slides:none on file

Dagger 2 generates zero-arg factories and then composes them into a dependency graph, does compile-time cycle checks, and strips unused bindings so dead features disappear. Optimization strategies include ahead-of-time inlining (an experiment with thousands of bindings inlines 100% of factories so no generated factories remain), ProGuard eliminating Dagger entirely (removes Dagger after ProGuard), preferring static module methods for ~15–20% faster invokes, and using @Binds instead of @Provides to avoid wrapper objects and extra method calls.

AI-written summary · about

  1. 0:00Understanding Dagger 2
  2. 1:18public interface Provider
  3. 2:02final class Bar @Inject Bar(Foo foo) {}
  4. 2:51final class Baz static Baz create(Bar bar)
  5. 5:29OK, neat trick
  6. 7:23What's the catch?
  7. 7:59Dagger optimizations
  8. 9:46DI-friendly choices
  9. 11:37Optimizable APIS
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.