Dagger generates invalid code
See original GitHub issueDagger generates invalid code if auto-value annotations are present, but auto-value processor is not configured as an annotation processor. This can lead to compile failures that are hard to understand.
Also the error message @AutoAnnotation is a necessary dependency if @MapKey(unwrapValue = false). Add a dependency on com.google.auto.value:auto-value:<current version>
in MapKeyValidator
is misleading, because
AutoAnnotation
is not in artifactauto-value
but inauto-value-annotations
- Having
AutoAnnotation
on the classpath does not imply thatauto-value
is also working as an annotation processor
See demo
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Dagger 2 component not generated - Stack Overflow
If Dagger2 can not generate its components it means that your code have some errors with Scopes/Modules. Check our your @Provides/Inject ...
Read more >Deep dive into Dagger generated code (part 1) - ProAndroidDev
In this blog post, we will convert the Dagger generated code from Java to Kotlin to understand how @Inject constructors and @Provides works....
Read more >Dagger 2 Generated Code - Medium
Basically, Dagger 2 generates a bunch of factories for your provided dependencies.
Read more >Dependency Injection with Dagger 2 - CodePath Cliffnotes
Android Studio by default will not allow you to navigate to generated Dagger 2 code as legitimate classes because they are not normally...
Read more >Android - Dagger
Dagger 2 is the first to implement the full stack with generated code. ... public class CoffeeApp { public static void main(String[] args)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I considered this more of an issue with improper setup of auto-value (on the user side) due to a misleading error message (on the Dagger side). Understandably, you could argue that the user shouldn’t have to add these dependencies manually, but this is currently working as intended to avoid adding the auto-value dependencies to all users who aren’t using the feature.
That said, I’m currently discussing with the team on ways we can improve this experience, e.g. by reevaluating adding the auto-value dependency (which should be pretty small now that the annotations have their own artifact), shading auto-value into Dagger, or just reimplementing that part ourselves.
I’m happy to leave this issue open until we make a decision on that.
Seems like this ticket was closed, but the problem was not fixed.