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.

Wrong codegen behavior when trying to inject instance with Qualifier but component has instance without Qualifier in its dependencies

See original GitHub issue

Hello!

I’ve just faced an issue when tried to inject one instance with qualifier when my component has another component which provides instance without qualifier in its dependencies.

For instance, there’s two components:

ComponentA ComponentB (depends on ComponentA).

ComponentA provides Sample without qualifier. ComponentB provides Sample with qualifier @BImpl

I’m trying to inject Sample with qualifier to Container:

class Container {

    @Inject
    lateinit var sampleA: Sample
    @Inject
    @BImpl
    lateinit var sampleB: Sample

}

But both samples are ImplA.

Is it intended behavior? Because for me this is unexpected and seem like a bug.

Here’s a sample project: https://github.com/IlyaGulya/Dagger2QualifierBugSample Please run test dagger2qualifiersample.TestSample.example() to reproduce the issue. Both calls prints ImplA.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
ronshapirocommented, Jul 8, 2019

Reopening this as it’s probably a good area for us to document

0reactions
IlyaGulyacommented, Mar 5, 2020

Closing since this is fixed in https://github.com/google/dagger/releases/tag/dagger-2.25.2 and there’s no more need to document it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring @Qualifier isn't working without @Primary [duplicate]
So, I am trying to learn my way with Spring Boot. I tried @Qualifier and @Autowired but it gives me the following error:...
Read more >
Troubleshooting contexts and dependency injection - IBM
Disambiguate the injection point by adding a qualifier to the injection point and if necessary, one source of the dependency. If necessary, ...
Read more >
Tasting Dagger 2 on Android. | Fernando Cejas
Dependencies can be injected into a component: it is possible to inject mock implementations of these dependencies which makes testing easier.
Read more >
Eager Initialization of Singletons - Micronaut Documentation
A bean is an object that has its lifecycle controlled by the Micronaut IoC ... for a given interface that you want to...
Read more >
ActiveJ Inject Basics | Lightning-fast and ultimately powerful ...
Applications are made up of components, and each component has an ... Object qualifier (useful when you want to distinguish between keys of...
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