square / dagger

A fast dependency injector for Android and Java.
https://square.github.io/dagger/
Apache License 2.0
7.3k stars 3.07k forks source link

Error when a component is trying to include bindings with different scopes could be more informative #557

Closed benkay closed 6 years ago

benkay commented 6 years ago

If a class included in a component with @ScopeA depends on a binding with @ScopeB, then a compilation error is thrown

ComponentA scoped with @ScopeA may not reference bindings with different scopes:

    @ScopeB class a.b.ClassWithScopeB

This is useful in the case where ClassWithScopeB has the wrong scope annotation, but it gives no help in discovering the dependency chain which is causing ClassWithScopeB to be included in ComponentA in the first place. In a large component graph this can be non-trivial

benkay commented 6 years ago

Derp. Filed this in the wrong dagger project 😳