-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dagger generates invalid code #3091
Comments
Thanks, those instructions are from a while ago when I'll send out a fix soon. |
Hi bcorso, good idea. The error message should be changed, but changing the error message alone would not fix this issue. Dagger would still generate invalid code. The demo project would still fail with a "cannot find symbol" error like this:
The issue here is that the error message is not printed at all, and invalid code is generated instead, and this would still be the case after changing the error message. To fix this issue, consider one of the following options:
|
In this case, the reason you don't see the error message is because your demo project adds the Assuming that you initially have neither dependency you should see the Dagger error message, which should now tell you to add both the Fwiw, we may also follow up with a more automatic fix that either adds the |
So is this fixed now? What's the fix version? |
The error message was updated in eeb93c9 (you can scroll up to see related commits). The changes are not yet in a release, but you can test out the change with the |
Seems like this ticket was closed, but the problem was not fixed. |
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. |
Dagger 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>
inMapKeyValidator
is misleading, becauseAutoAnnotation
is not in artifactauto-value
but inauto-value-annotations
AutoAnnotation
on the classpath does not imply thatauto-value
is also working as an annotation processorSee demo
The text was updated successfully, but these errors were encountered: