Dagger 2 v2.22 Release Notes

Release Date: 2019-04-02 // almost 5 years ago
  • ๐Ÿš€ NOTE: A bug in the Dagger compiler was introduced in this release. A fix is available in 2.22.1

    • โž• Add the ability to create @Component.Factory types for components instead of @Component.Builders. An @Component.Factory is stateless and has a single method, returning the creator type, that takes parameters for anything that a Builder could have setters for. (d340886)
    • ๐Ÿ— @BindsInstance can now be applied to the parameter of a setter method on a builder rather than to the setter method itself, for consistency with factory methods. (60dc2a6)
    • ๐Ÿ— When a single instance of a component builder with no setter for a particular module that Dagger can instantiate is used to instantiate multiple component instances, provide a new instance of that module to each component rather than caching and reusing a single instance of the module for each component. (fa714e9)
    • Public modules are now allowed to include non-public modules when those included modules do not require an instance: that is, they only have abstract and/or static binding methods. (bfdecad)
    • ๐Ÿ›  Fix @BindsOptionalOf methods to require that they have a different name than any other binding method in the module; this was already true for all other types of binding methods (@Provides, @Binds etc.) but @BindsOptionalOf wasn't being included. (1ea36ec)
    • ๐Ÿ‘ Report an error for scopes on @Multibinds methods. This was never supported, but the scope was previously ignored. (9582bc3)
    • Limit the number of requests and entry points reported explicitly for errors. (1d5d829)
    • ๐Ÿ— SPI: Renamed BindingKind.SUBCOMPONENT_BUILDER to SUBCOMPONENT_CREATOR to reflect the fact that it can be a builder or a factory, and renamed the edge type to SubcomponentCreatorBindingEdge. (65e2209)
    • ๐ŸŽ Build performance improvements: