question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dagger generates code with wrong parameter names for member injection

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

8reactions
bcorsocommented, 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.

0reactions
vRallevcommented, Jul 29, 2022

The fix works. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dagger 2: Injecting user inputted parameter into object
Basically, you create an injectable factory class that takes runtime parameters such as address as arguments to the object creation methods that it...
Read more >
Deep dive into Dagger generated code (part 2) - ProAndroidDev
Factory as constructor parameters of the component. Members injection. Sometimes we don't control the lifecycle of an object — we can't ...
Read more >
Android - Dagger
Dagger is a fully static, compile-time dependency injection framework for both Java and Android. It is developed by the Java Core Libraries Team...
Read more >
Using Dagger 2 for dependency injection in Android - Tutorial
Dagger 2 is dependency injection framework. It is based on the Java Specification Request (JSR) 330. It uses code generation and is based...
Read more >
Dependency Injection in Kotlin using Dagger2
The generated code is very relatively easy to read and debug. ... Dagger doesn't support Injection in private fields and the final field....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found