Releases: google/dagger
Dagger 2.45
Dagger 2.45
What’s new In Dagger
Bug Fixes
- Fixed an issue where a scoped
@Binds
used in a cycle would cause an NPE on component creation in fastInit mode. (fae46c7) - Fixed #3677. Added a better error message for when
@Multibinds
types incorrectly used framework types likeProvider
. (f5ad2b2) - Fixed an issue where when giving a missing binding error, an available matching binding in another component would not be suggested if the matching binding was otherwise unused. (00d84ba)
What’s new in Hilt
Bug Fixes
Dagger 2.44.2
What’s new in Dagger
Bug fixes
- Fixes #3633: Updated shading rules to include newly added classes in
androidx.room.compiler
to prevent class version conflicts with user dependency on Room.
Dagger 2.44.1
What’s new in Dagger
Bug fixes
- Fixes #3619: Upgrades XProcessing jars to get upstream fix for enums in annotations (which were missing fully qualified name or import in generated code).
Dagger 2.44
What’s new In Dagger
Potentially breaking changes
- Fixes #3531: Removed formatting from dagger.android generated source could be a breaking change for anyone relying on golden files for Dagger’s generated code. (d123efd)
Bug Fixes
- Fixes #3522: Avoids pre-validating the nearest enclosing type in the InjectProcessingStep. (1d74d1f)
What’s new in Hilt
Potentially breaking changes
- Added
ViewModelLifecycle
. This can be injected in the ViewModelComponent and used to register listeners for whenViewModel#onCleared()
is called. This change also includes a breaking change for anyone who implemented theActivityRetainedLifecycle
interface themselves. This should be rare though as this interface was not meant to be implemented by users. (55aa4c6)
Bug Fixes
Dagger 2.43.2
What’s New In Dagger
Bug Fixes
- Fixes #3495: Updates the XProcessing jars, which should again be compatible with java 8. (62b7f45)
- Adds support reading metadata from Kotlin 1.8 by updating kotlin-metadata-jvm to 5.0. (353a50b)
- Fixes an issue where the Hilt Gradle Plugin artifact was being bloated with additional classes causing its size to be way bigger than its suppose to be. (8235beb)
Dagger 2.43.1
What’s New In Dagger
Bug Fixes
- Fixes #3480. Replace dependency on
javax.annotation:jsr250-api:1.0
withjavax.annotation:javax.annotation-api:1.3.2
. (e9dc377) - Fixes #3483: Add onPluginEnd to BindingGraphPlugin, which will be called after all BindingGraphPlugins have been visited (3445275)
- Fixes #3476: Fix issue with Dagger generating mismatching parameter names in component inject functions. (90300d9)
Dagger 2.43
What’s New In Dagger
Potentially Breaking Changes
- Note: Dagger 2.43/2.43.1 require java 11 due to a change in Dagger's XProcessing dependency.
However, this requirement has been recently reverted in XProcessing
and Dagger 2.43.2 should support java 8 again (see issue #3495).
Bug Fixes
- Fixes #3401 where Dagger generated mismatched parameter names in subcomponent factory method implementations when the original factory method is in a separate build unit from the component that implements it.
What’s New In Hilt
Potentially Breaking Changes
- Hilt now throws if the base activity/fragment class’s
getDefaultViewModelProviderFactory()
returns null. This is unlikely to happen though unless overridden by the user to return null. (9eee8e4) - As part ViewModel bug fixes, dependencies were updated as below.
androidx.navigation
users will need to update to 2.5.0 to interoperate. These libraries require building with SDK 31. To build with SDK 31, AGP users will need to use AGP 7.0+. This will also require using JDK11.androidx.activity
andandroidx.fragment
to 1.5.0androidx.lifecycle
to 2.5.0androidx.savedstate
to 1.2.0
Bug Fixes
- Fix #3464 where SPI plugins were not being invoked with Hilt's Gradle Plugin aggregation (
enableAggregatingTask
) turned on. (b838876) - Fixes #2328 and #3232 where getting multiple instances of
@HiltViewModel
with different keys would cause a crash. - Fixes #2152. hiltNavGraphViewModels is now no longer necessary to use
@HiltViewModel
with navigation backstack entries as the owner. The defaultViewModelProvider.Factory
from activities and fragments can be used directly with the backstack entry as the owner. (74ea765) - Make it so that map keys used with
@BindValueIntoMap
in Kotlin code do not need to use the@field
notation. (e591833)
Dagger 2.42
What’s new in Dagger
Potentially breaking changes
As of this release, Dagger’s generated class will no longer extend the user-defined @Component
annotated class (885b16d). This change was done to improve build times in certain scenarios by avoiding a known javac bottleneck. However, it may also be a breaking change for some users. For example
// This will fail as of Dagger version 2.42
DaggerMyComponent component = DaggerMyComponent.create();
// Do this instead:
MyComponent component = DaggerMyComponent.create();
For migration purposes, we’ve added a temporary javac flag that can be used to re-enable the legacy behavior (the flag is disabled by default).
-Adagger.generatedClassExtendsComponent=ENABLED
This flag will be removed in a future version of Dagger.
What’s new in Hilt
Bug fixes
- Fix two issues (e3d4468):
matchingFallbacks
being ignored work with Hilt.- Hilt causing jetifier to execute twice.
- Allow Hilt view constructor to contain non-declared types. (dc76e82)
- Fix #3222. Generated fragment code previously would cause a Lint issue around
LayoutInflater.from()
. (850fc84) - Fix #3329 where modules in a package with non-standard capitalization could cause an error in the Hilt Gradle Plugin. (029fe57 and 329915f)
Dagger 2.41
What’s New In Dagger
Potentially Breaking Changes
-
This release fixes a recently noticed, but long-standing bug (#3136) where Dagger’s processors may silently miss a scope/qualifier on a binding if the scope/qualifier annotation is unresolvable (i.e. it is not on the classpath).
Dagger will now prefer to fail the build if there are any unresolvable annotations present where a scope/qualifier is allowed. While Dagger does its best to avoid failing the build for non-scope/qualifier annotations, in general it’s not possible to tell if an annotation is a scope/qualifier unless its type is resolvable -- thus, Dagger may fail on non-scope/qualifier annotations as well.
If these changes break your build, we recommend first trying to fix the breakage by adding the appropriate missing dependencies to your build (in most cases the error message should tell you exactly what type is missing). Although not recommended, you can revert back to the old behavior using the compiler option-Adagger.strictSuperficialValidation=DISABLED
; however, this option will be removed in a future release. If the breakage is specifically due to the validation of transitive component dependencies, you may choose to disable that validation using-Adagger.validateTransitiveComponentDependencies=DISABLED
. If the breakage is specifically due toandroidx.hilt:hilt-lifecycle-viewmodel
you will need to migrate to the native Hilt API (see #3257 (comment)). -
This release fixes an accidental regression (introduced in Dagger version 2.39) that allowed requesting a raw
@Inject
constructor type which was previously not allowed (a61aa50).
We expect breakages due to this issue to be relatively rare and easy to fix -- just replace the raw type with the proper parameterized type. -
The string format of bindings has changed slightly (just spacing). SPI plugins that depend on this format may break. Note that as KSP migrations go forward, other string formats may change slightly in similar ways as well.
New Changes
-
Dagger error messages for unresolvable deferred types have been improved. Error messages now tell you exactly which type could not be resolved and where it was found. Fixes #2208 (727068f), Fixes #3133 (78646fb)
-
Dagger now supports reading the
jakarta.inject
versions ofInject
,Scope
,Qualifier
, andSingleton
. Dagger currently does not supportjakarta.inject.Provider
. Also, code generated by Dagger (and Hilt) continue to use thejavax.inject
symbols. Further changes and support to come in future releases. (2195513)
Bug Fixes
- Updates dagger-lint to avoid displaying a warning due to missing Vendor information. (cb33cc5)
- Fixes an issue where Dagger's lint checks wouldn't work with lint 30.2.x-alpha due to using a removed API. (33ba899)
- Fix #3069 where a class named "Create" could cause a conflict with the create() method on a component. (5ba04fb)
- Fix #3143 where a crash about a missing shard would occur when a members injection binding exists in a parent component. (3545f01)
- Fix #3091. Update MapKey error message to reference new auto-value artifacts. (91e7df1)
What’s New In Hilt
New Changes
-
The Hilt Gradle Plugin now supports the updated Gradle plugins DSL as described in https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block via its new id:
com.google.dagger.hilt.android
. (e50aa06) -
There is now a new
@CustomInject
annotation to control when field injection occurs in an@HiltAndroidApp
application class. See https://dagger.dev/hilt/custom-inject for details. (36c17bb)
Bug Fixes
- Fix an issue where Hilt transform was not correctly updating the Signature attribute of an
@AndroidEntryPoint
whose superclass contained a type variable. (475cc05) - Fixes #3119: Added kotlin-stdlib to pom dependencies to avoid breaking java-only projects. (3ec422e)
- Support AGP 7.2 ASM API changes (5502cd7)
Dagger 2.40.5
Dagger bug fixes
- Fixes #3090. Fixes an issue where the superficial validation for inject types was validating deeper than necessary and triggering failures when some classes were not available in the compile classpath.