Dagger2 v2.18 Release Notes

Release Date: 2018-10-19 // over 5 years ago
    • Producers:
      • Added @CancellationPolicy annotation, which can be used to make a production component or subcomponent allow cancellation of its subcomponent(s) to propagate up to it and cancel its nodes as well. (f5c04a5)
      • Producer cancellation is now deterministic; cancelling an entry point of a production component will now ensure that it cancels all running tasks for that component and prevents any further tasks for that component from starting. For components with more than one entry point, this does mean that cancelling one entry point will cancel all entry points for the component. For production subcomponents, cancellation of a subcomponent entry point will not propagate cancellation to tasks owned by an ancestor component. (ea48dfd)
    • 👍 Better Errors:
      • Change constructor bindings and dependency requests from void package.Class.<init>(params) to package.Class(params), which looks more like how Java users think of constructors. (d31943c)
      • Report errors on members injection component methods and MembersInjector requests that have qualifiers. (3be3073)
      • Report erroneous bindings once for all their incoming dependency requests, instead of once for each incoming dependency request. If a binding is owned in more than one component, it will still be reported once for each component that owns it. (beefa94)
      • Report errors when members-injecting primitives and arrays in component methods as well as unused bindings. (d6a0db3)
      • Report binding graph errors once at the root component, not once per entry point from which the error is reachable. Include the dependency trace from one entry point only, and list the other entry points from which the error is reachable. (46f315f)
      • Report errors for dependency requests with multiple qualifiers in @Provides and @Produces methods and component entry points instead of throwing IllegalArgumentException. (da2e1f0)
    • dagger.android:
      • Adds a support version of DaggerDialogFragment (47be5db)
    • 🏗 Build perf:
      • Add an option to disable formatting of generated code: -Adagger.formatGeneratedSource=disabled (6814a21)
      • Add support for gradle's incremental annotation processing. This can be enabled by passing -Adagger.gradle.incremental to javac (cd83b30)
      • Originating elements are now reported to the Filer (baf2357)
      • Improvements in processing time (b0786a5)
    • 🐛 Bug fixes:
      • Fixes bug in fast init (b/116268009). (be9493d)
      • Report an error (instead of throwing IAE) if a component builder method has a primitive parameter and is not annotated with @BindsInstance. (5c69aab)
      • Avoid IncompatibleClassChangeError in DiagnosticReporterImpl when guava-android is on the processor path. (efb042d)