Skip to content

Dagger 2.41

Compare
Choose a tag to compare
@Chang-Eric Chang-Eric released this 16 Feb 22:04
· 700 commits to master since this release

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)