error: @Provides methods may not override another method.
See original GitHub issueI want to use @Provides
in-conjunction with @Override
. but dagger says error: @Provides methods may not override another method.
. So I wrote below fix
@Override
protected X getX() {
return new X();
}
@Provides
X provideX() {
return getX();
}
Is this a good approach ?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
How do you override a module/dependency in a unit test with ...
In our tests we want to provide StringHolder with "Test string". ... Error:(24, 21) error: @Provides methods may not override another method.
Read more >Any way to override bindings? - Google Groups
Hi there. We have a parent project and a child project. The child project is a customization of the parent project, where some...
Read more >Testing with Dagger
Do not override bindings by subclassing modules · Using a module subclass cannot change the static shape of the binding graph: it cannot...
Read more >Chapter 8. Classes - Oracle Help Center
Any of C's superclasses has an abstract method declared with package access, and there exists no method that overrides the abstract method from...
Read more >Dagger - Square Open Source
Fix the problem either by adding an @Provides -annotated method for Executor , or by marking the module as incomplete. Incomplete modules are...
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 got here by googling the error message (of course). So this issue is important, even while closed.
I’ll add my 2 cents: here’s an explanation of a common use case that would naturally lead to inheritance of Modules, and the recommended way to implement it: https://dagger.dev/testing.html
@theapache64 how did you solve this problem? do you have any sample project which you could share?