Guliash Guliash - 3 years ago 75
Android Question

Dagger does not throw exception if a subcomponent has conflicting scope with one of the parent components

ComponentA (scopeA)

ComponentB (scopeB, dependencies = ComponentA)

ComponentC (scopeC, dependecies = ComponentB)

SubcomponentD (scopeA, created from ComponentC).

No exception is thrown though D has conflict with A (code)

If we leave only
ComponentA (scopeA)

SubcomponentD (scopeA, created from ComponentA)

then the conflicting scopes exception will be thrown.

Why in the first case no exception thrown?

I created an issue but no answer yet.

Answer Source

I got it. A subcomponent is a part of its parent component (not any ancestor subcomponent). So Dagger checks the scopes hierarchy for each component (not for the whole graph). See here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download