BindsInstance is optional
See original GitHub issueIf a method annotated with BindsInstance
is not invoked, then the injected field is nullable. Why can’t it be made required to invoke the method? If the method is not invoked, then it can be removed to any clutter in the first place.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
BindsInstance - Dagger
Marks a method on a component builder or a parameter on a component factory as binding an instance to some key within the...
Read more >how it works @BindsInstance dagger 2 - Stack Overflow
@bindsInstance is used for removing constructor from module and chaining modules where you get component. Without @BindsInstance
Read more >Avoid Nullable dependencies in Dagger2 with ... - Medium
Many functional programming libraries don't even allow us to pass null values in the system, and Optional comes really handy dealing with these ......
Read more >dagger.BindsInstance.<init> java code examples - Tabnine
BindsInstance abstract Builder application(Application application); ... @TestingPlugins Optional<ImmutableSet<BindingGraphPlugin>> testingPlugins);.
Read more >Stop Holding Dagger by the Blade: Use the Hilt | Infinum
Builder interface Builder { @BindsInstance fun application(application: ... Step 4 (Optional): Integrate Hilt with ViewModels.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I didn’t fully understand. Are you saying that today, it’s not required to invoke
@BindsInstance
methods? I think that’s only the case if a@Nullable
annotation is used together with@BindsInstance
.Or are you proposing a feature?
Got it. Wish somehow these injections (@Inject) can be marked as nullable or optional.
Also, from the doc:
It seems the methods in which parameters are not marked as
Nullable
should always be called. Maybe fix the javadoc.