Skip to content

Releases: google/dagger

Dagger 2.43

21 Jul 20:45
Compare
Choose a tag to compare

What’s New In Dagger

Potentially Breaking Changes

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 and androidx.fragment to 1.5.0
    • androidx.lifecycle to 2.5.0
    • androidx.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 default ViewModelProvider.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

09 May 21:10
Compare
Choose a tag to compare

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):
    1. matchingFallbacks being ignored work with Hilt.
    2. 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

16 Feb 22:04
Compare
Choose a tag to compare

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 to androidx.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 of Inject, Scope, Qualifier, and Singleton. Dagger currently does not support jakarta.inject.Provider. Also, code generated by Dagger (and Hilt) continue to use the javax.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

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

06 Dec 22:24
Compare
Choose a tag to compare

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.

Dagger 2.40.4

02 Dec 17:26
Compare
Choose a tag to compare

What’s New in Dagger

Bug Fixes

Fix #3075: Fixes an issue where we were not deferring processing for a generated type in Kotlin source (745d30c)

Dagger 2.40.3

29 Nov 18:30
Compare
Choose a tag to compare

Dagger bug fixes

  • Fixes #3065: Fixes an issue caused by our XProcessing migration (to support KSP). For now, we’ve replaced all problematic usages of XElement#getName() with XElements#getSimpleName(XElement) which ensures we use the old javac simple name.

Dagger 2.40.2

24 Nov 00:55
Compare
Choose a tag to compare

Dagger Bug Fixes

  • Fix #2997, #3032: Fixed issue with @BindsInstance parameters when bound types are from compiled dependencies. (ec1a98c).

Hilt New features

  • Add convenient overloads for Kotlin users of EntryPointAccessors (6e1f0ea)
  • @AliasOf now accepts multiple scope annotations. (aa92b9e)

Hilt Bug Fixes

  • Fix #3006:Sort dependencies in ComponentTreeDeps manually to give consistent output when doing incremental processing. (93f04ae)

Dagger 2.40.1

11 Nov 17:04
Compare
Choose a tag to compare

Bug Fixes

  • Fix an AGP 7.2 incompatibility issue in the Hilt Gradle Plugin due to AGP breaking their API when cleaning up a deprecated type. (ed677ba)
  • Fix #2986 - An issue in the Dagger processor where it would crash due to a bad initialization. (608bcba)

Dagger 2.40

27 Oct 23:03
Compare
Choose a tag to compare

What’s New in Hilt

New Changes

  • Flip the runtime flag default so that the fix is off and remove the compiler option for the Fragment.getContext() fix to make it easier to roll out the fix. This does not change the current default behavior of having the fix be off. (1c24b97, e61ff72)
  • Turn ON enableAggregatingTask by default in Hilt (90ea6a6)

Bug fixes

  • EarlyEntryPoints#get() will now throw if there are no @EarlyEntryPoint annotated interfaces. (b5ef01c)
  • Avoid using UAST implementation classes in Lint checkers. (44e1f05)
  • Fix an issue where @OptionalInject activity/fragment classes could not be used with non-Hilt ViewModels. (8ef08fa)

Dagger 2.39.1

01 Oct 16:39
Compare
Choose a tag to compare

Hilt bug fixes

  • Fix #2834: Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations. (db21d3f)
  • Fix #2904: Change toImmutableSet to use DaggerStreams rather than Guava. (43a7fe1)