Comments (4)
Why is it bound by
@Component.modules
in ChildScope if the@Provides @ParentScoped
has different scope from the component?
By adding a module to @Component.modules()
it means every @Provides
/@Binds
method in that module is installed in that component. There's no way to tell Dagger to only install certain @Provides
methods and not others.
Doesn't docs say components cant have differently scoped providers in them?
That's correct. Normally, if you try to install a module in a component and one of its @Provides
methods has the wrong scope then Dagger will report an error about it. I think the only reason you aren't seeing that here is because Dagger checks for duplicate bindings first, so it's reporting that error instead.
from dagger.
i want to group stuff together by functionality in modules throughout cross-cutting concerns components from different level of scoping. Is there an alternative way of doing it without requiring me to split into module-per-scope?
No, you will need to split the provides methods into two separate modules.
is there a simple explanation why is String a being bound multiple times? I didn't bind it anywhere in ChildScope.
It's bound once via the @Component.modules = SharedModule.class
and again via the @Component.dependencies = ParentScope.class
.
from dagger.
Why is it bound by @Component.modules
in ChildScope if the @Provides @ParentScoped
has different scope from the component? Doesn't docs say components cant have differently scoped providers in them? It should probably try to use binding from parent if scope doesn't match, no?
from dagger.
Thanks for the insightful comment. Appreciate it. I'll use separate modules then 😁
from dagger.
Related Issues (20)
- [KSP] An AndroidX dependency with Room fails to build HOT 2
- [KSP] A failure occurred while executing dagger.hilt.android.plugin.task.AggregateDepsTask$WorkerAction HOT 3
- [ksp] Dagger fails to resolved ViewBinding classes generated by the Android Gradle plugin HOT 9
- [ksp] Non explicit type specification on @Provides causes error.NonExistentClass HOT 12
- [KSP] After migrating to ksp Assisted Inject factory implementations cannot be found during incremental compilation HOT 5
- [KSP] Incorrect generates map binding code for ClassKey when class is generic HOT 1
- [KSP][Android] WorkManagers cannot be created when using Hilt + KSP HOT 13
- [KSP] Doesn't work well with `kotlin.Result` HOT 2
- [KSP][Android] Delete a hilt view model breaks incremental compilation in ksp HOT 2
- [KSP][Android] Non existing type error on class generated from Android Navigation arguments HOT 4
- [KSP] [Hilt] Incremental compilation fails with java.lang.NullPointerException HOT 4
- Possible incorrect lenience with generic types HOT 4
- Confusing fastInit Documentation with Hilt
- ViewModelLazy.getvalue initialization exception HOT 1
- Cause: dagger.spi.BindingGraphPlugin: dagger.hilt.android.processor.internal.viewmodel.ViewModelValidationPlugin not a subtype HOT 11
- Feature Request: Simpler creation of custom components (and integrating with Android components)
- KAPT (non-AGP) fails to see correct superclasses in Hilt AndroidEntryPoint processor HOT 3
- v2.48: android.util.SuperNotCalledException... did not call through to super.onCreate() HOT 2
- [KAPT][Android] null cannot be cast to non-null type kotlinx.metadata.jvm.KotlinClassMetadata.Class HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dagger.