forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Scoped binding isn't scoped if scope isn't on classpath. #3136
Labels
Comments
copybara-service bot
pushed a commit
that referenced
this issue
Dec 29, 2021
This CL adds some infrastructure to run multi-module Gradle build tests to javatests/artifacts/dagger, and creates a repro test for issue #3136. RELNOTES=N/A PiperOrigin-RevId: 418822365
copybara-service bot
pushed a commit
that referenced
this issue
Dec 29, 2021
This CL adds some infrastructure to run multi-module Gradle build tests to javatests/artifacts/dagger, and creates a repro test for issue #3136. RELNOTES=N/A PiperOrigin-RevId: 418822365
copybara-service bot
pushed a commit
that referenced
this issue
Dec 29, 2021
This CL adds some infrastructure to run multi-module Gradle build tests to javatests/artifacts/dagger, and creates a repro test for issue #3136. RELNOTES=N/A PiperOrigin-RevId: 418853078
copybara-service bot
pushed a commit
that referenced
this issue
Jan 10, 2022
This CL adds a test showing a missing qualifier if the annotation is missing on the classpath during processing. RELNOTES=N/A PiperOrigin-RevId: 420662003
copybara-service bot
pushed a commit
that referenced
this issue
Jan 10, 2022
This CL adds a test showing a missing qualifier if the annotation is missing on the classpath during processing. RELNOTES=N/A PiperOrigin-RevId: 420810694
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This is useful so that we can skip superficial validation of annotations that are not scopes when validating inject types in subsequent compilation units. RELNOTES=Fixes missing scopes described in #3136. However, this change only fixes one case of missing scopes on @Inject types -- there are a number of other cases that still need to be fixed for this bug to actually be closed. PiperOrigin-RevId: 420166213
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This is useful so that we can skip superficial validation of annotations that are not scopes when validating inject types in subsequent compilation units. RELNOTES=Fixes missing scopes described in #3136. However, this change only fixes one case of missing scopes on @Inject types -- there are a number of other cases that still need to be fixed for this bug to actually be closed. PiperOrigin-RevId: 421042966
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This CL adds a test for transitive scope and qualifier on a module's @provides method. RELNOTES=N/A PiperOrigin-RevId: 420943853
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This CL adds a test for transitive scope and qualifier on a module's @provides method. RELNOTES=N/A PiperOrigin-RevId: 420943853
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This CL adds a test for transitive scope and qualifier on a module's @provides method. RELNOTES=N/A PiperOrigin-RevId: 421067911
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This CL adds tests to show how Dagger handles unrelated transitive annotations on the module and inject classes. RELNOTES=N/A PiperOrigin-RevId: 420662469
copybara-service bot
pushed a commit
that referenced
this issue
Jan 11, 2022
This CL adds tests to show how Dagger handles unrelated transitive annotations on the module and inject classes. RELNOTES=N/A PiperOrigin-RevId: 421078020
copybara-service bot
pushed a commit
that referenced
this issue
Jan 18, 2022
This CL adds tests for @BINDS usages with scopes and qualifiers. RELNOTES=N/A PiperOrigin-RevId: 422554664
copybara-service bot
pushed a commit
that referenced
this issue
Jan 18, 2022
This CL adds tests for @BINDS usages with scopes and qualifiers. RELNOTES=N/A PiperOrigin-RevId: 422554664
copybara-service bot
pushed a commit
that referenced
this issue
Jan 18, 2022
This CL adds tests for @BINDS usages with scopes and qualifiers. RELNOTES=N/A PiperOrigin-RevId: 422618557
This will be fixed in the next release (v2.41). |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dagger treats scoped bindings as unscoped if the scope isn't on the classpath.
This may be a rare case, but the situation can happen if you have a setup like
:component -> :subcomponent -> :subcomponent-scope
where:subcomponent-scope
is animplementation
dependency of:subcomponent
and thus isn't on the classpath of:component
.The expected behavior is that the build would fail in this case, and ideally with an error message that tells the user that the scope cannot be resolved.
Normally, this would be handled by our use of
SuperficialValidation
. However, the fact that the build doesn't fail seems to be due to a bug inTypeVisitor
which causes it to visitvisitDeclared
rather thanvisitError
for an annotation's type even if it hasTypeKind.ERROR
. Thus,SuperficialValidation
will report that the annotation's type is valid when it's actually not. Furthermore, getting the correspondingTypeElement
for that annotation and checkingElement#getAnnotationMirrors()
will return an empty list, which fools Dagger into thinking that the annotation is not a scope (since it can't find the@Scope
annotation).The text was updated successfully, but these errors were encountered: