Repository navigation
Releases
Releases · google/dagger
Dagger 2.24
- Deprecations/removals
dagger.android'sHas{Activity,Fragment,Service,ContentProvider,BroadcastReceiver}interfaces are now removed in favor ofHasAndroidInjector(which can handle any type).HasAndroidInjectorwas added in 2.23, and is supported together with the old types in that version. (3bd8f70)
- Bug fixes
- Duplicate keys were erroneously not detected when MapKey.unwrapValue=false which may have resulted in a runtime error (depending on whether fastInit mode was used). This is now detected and failed at compile time. (8b5dbea)
- Build performance
- Gradle's incremental annotation processing is now enabled for all builds (50bc180)
Dagger 2.23.2
In addition to the 2.23.1 release notes, this release:
Dagger 2.23.1
In addition to the 2.23 release notes, this release fixes support for gradle incremental annotation processing (a91d962)
Dagger 2.23
- Validation/strictness
- Build performance
- Android
- Added
dagger.android.HasAndroidInjector, which will soon replace theHas*Injectorinterfaces. This one interfaces coalesces the others and should be functionally equivalent. (8f01526)
- Added
- Full Binding Graph Validation
- Bug Fixes
Dagger 2.22.1
In addition to the 2.22 release notes, this release fixes an issue where @BindsInstance on a @Component.Builder setter method's parameter caused a failure in code generation if the parameter had a different name than the method itself (#1464). (8051d28)
Dagger 2.22
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.Factorytypes for components instead of@Component.Builders. An@Component.Factoryis stateless and has a single method, returning the creator type, that takes parameters for anything that a Builder could have setters for. (d340886) @BindsInstancecan 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
@BindsOptionalOfmethods 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,@Bindsetc.) but@BindsOptionalOfwasn't being included. (1ea36ec) - Report an error for scopes on
@Multibindsmethods. 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_BUILDERtoSUBCOMPONENT_CREATORto reflect the fact that it can be a builder or a factory, and renamed the edge type toSubcomponentCreatorBindingEdge. (65e2209) - Build performance improvements:
Dagger 2.21
- Build performance improvements (174a7a9)
- Separately, there may be an increase in build times for opensource users using javac9 or javac10. Neither javac8 or javac11 should be affected. (96fcce8)
- New validation:
- Installing a module with scoped bindings that an ancestor component has also installed is now an error. (4695ff5)
- A warning is now reported if an explicit binding conflicts with an
@Injectbinding in an ancestor component. This was never intended to be supported but never checked. Adds a flag to control whether that is a warning or an error. (7f5500f) - Installing a
@ProducerModulein a@Subcomponentthat is already installed in a parent (or earlier ancestor) component is now an error. It is also an error to repeat a@Modulethat has a binding in@ProductionScope. (68b2153)
- SPI
- New method:
ComponentNode.isSubcomponent()(b6b9dca)
- New method:
- Producers
- Properly generate components when qualifiers are generated (ab9cdbc)
- Dagger itself now uses more Dagger (97fce1e)
Dagger 2.20
- Peformance improvements in annotation processing (8012ab5)
- Report duplicate bindings only once, not once per request. (623461f)
- Make sure all processing steps defer elements properly if they have missing types. (3b0fcc8)
- Make
@ProductionComponenthave runtime retention so tools can interpret it like all of the other component annotations (fff65e3) - 325b516:
- Add module-level validation. When
-Adagger.moduleBindingValidation=ERRORor=WARNINGis set, then each module is processed as a kind of component (without generating any code) in order to validate the bindings installed by it and all included modules. Any binding graph errors, such as duplicate bindngs (but not including missing bindings), will be reported as errors or warnings depending on the option.
- Add module-level validation. When
- Report map multibinding contribution errors once regardless of whether the map is requested as
Map<K, V>,Map<K, Provider<V>>, orMap<K, Producer<V>>. (350368e) - c7e7c4f:
- Fixes two bugs related to
@ProductionScopebindings:- Where modules with
@ProductionScopebindings are installed in multiple components in the same component ancestry, the binding is now resolved only once and only in the rootmost component. - When
@Injectbindings with@ProductionScopeare referenced in a binding graph, the binding is now resolved in the rootmost @ProductionScope component.
- Where modules with
- Fixes two bugs related to
- 221f000:
dagger.androidcode can no longer use theAndroidInjector.Factory<? extends Activity>format to bind injector factories. See https://google.github.io/dagger/android and the 2.19 release notes for information on how to migrate.- Adds an ErrorProne refactoring for migrating from
AndroidSupportInjectionModule(which now is functionless) toAndroidInjectionModule. See these docs for how to apply the refactoring to your codebase if you're ondagger-compiler-2.20.
- Removed
dagger.releaseablereferences(a72c342) - Removed the
-Adagger.floatingBindsMethodsflag added in 2.17 (https://github.com/google/dagger/wiki/Dagger-2.17-@Binds-bugs) (bc8dd5b)
Dagger 2.19
dagger.androidhas a new 8000 format for bindingAndroidInjector.Factorys:- Instead of returning
AndroidInjector.Factory<? extends Activity>(orService,Fragment, etc), return justAndroidInjector.Factory> - Instead of using
@ActivityKey(or@ServiceKey,@FragmentKey, etc), use@ClassKey. Thedagger.androidmap keys (with the exception of@AndroidInjectionKeyare now deprecated - If you use
@ContributesAndroidInjector, there's nothing to do. We have updated the output to match the new format - We have provided an ErrorProne refactoring for migrating to the new format of binding
AndroidInjector.Factorys withdagger.android. See these docs for how to apply the refactoring to your codebase if you're ondagger-compiler-2.19. (02dc4a7) - In the next release (2.20), we will remove the old format. This will allow us to support AndroidX packages better.
- For the complete docs, visit https://google.github.io/dagger/android
- Instead of returning
- Avoid some thrown errors during Dagger compilation for invalid modules. (4df5adf)
- Some formatting fixes even when the formatter is turned off
Dagger 2.18
- Producers:
- Added
@CancellationPolicyannotation, 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)
- Added
- Better Errors:
- Change constructor bindings and dependency requests from
void package.Class.<init>(params)topackage.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
@Providesand@Producesmethods and component entry points instead of throwingIllegalArgumentException. (da2e1f0)
- Change constructor bindings and dependency requests from
dagger.android:- Adds a support version of
DaggerDialogFragment(47be5db)
- Adds a support version of
- 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.incrementaltojavac(cd83b30) - Originating elements are now reported to the
Filer(baf2357) - Improvements in processing time (b0786a5)
- Add an option to disable formatting of generated code:
- 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)