Skip to content
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 code with wrong parameter names for member injection #3476

Closed
vRallev opened this issue Jul 21, 2022 · 5 comments
Closed

Dagger generates code with wrong parameter names for member injection #3476

vRallev opened this issue Jul 21, 2022 · 5 comments

Comments

@vRallev
Copy link

vRallev commented Jul 21, 2022

This issue is very similar to #3401. The bug for subcomponents is resolved, but there's still an issue with member injection. The generated code for member injection looks like this:

    @Override
    public void inject(Abc abc) {
      injectAbc(arg0);
    }

I've updated the sample here: https://github.com/vRallev/anvil/tree/ralf/dagger-bug Notice that the branch is ralf/dagger-bug. You should be able to reproduce the bug by running ./gradlew test. This issue happens with Dagger 2.43 and the latest snapshot.

@taehwandev
Copy link

taehwandev commented Jul 22, 2022

The same issue.

In the case of injecting in a custom class.

public void inject(CustomClass instance) {
 injectCustomClass(arg0);
}

It didn't happen in 2.42.

public void inject(CustomClass arg0) {
 injectCustomClass(arg0);
}

@bcorso
Copy link

bcorso commented Jul 22, 2022

Thanks for the repro! I should have a fix out today and we can do a 2.43.1 release next week.

@vRallev
Copy link
Author

vRallev commented Jul 22, 2022

That would be wonderful. Thanks!

copybara-service bot pushed a commit that referenced this issue Jul 22, 2022
…t functions.

Fixes #3476

Also adds a regression test for the issue.

RELNOTES=Fixes #3476: Fix issue with Dagger generating mismatching parameter name for inject functions.
PiperOrigin-RevId: 462675504
copybara-service bot pushed a commit that referenced this issue Jul 23, 2022
…t functions.

Fixes #3476

Also adds a regression test for the issue.

RELNOTES=Fixes #3476: Fix issue with Dagger generating mismatching parameter name for inject functions.
PiperOrigin-RevId: 462675504
@chrisjenx
Copy link

The funny thing is I wasn't having an issue until 2.43, so had to downgrade to 2.42, I'll wait until 2.43.1 and try again. Thanks for the quick fixes y'all

@vRallev
Copy link
Author

vRallev commented Jul 29, 2022

The fix works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants