-
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
Generated component error. Rawtype provider vs generic MembersInjector #939
Comments
Issue persists in Dagger 2.13 |
I have the same issue but with Dagger2 version 2.13, with 2.12 - everything alright |
Is this the same as #949? |
I do not think that this is caused by compiler. The generated code has mismatch between the required parameter of |
The problem is that since Dagger 2.12 you cannot do a member injection of a package private type which resides in another package than the main package of the application. So... the simplest solution would be, when Dagger2 would generate a different (or a second) MemberInjector static inject method. So that it does not expect the specific type of P but instead a Provider<P>. The Function call in DaggerComponent needs to change from This would trick the compiler because the raw provider would become a typed provider when given to the static inject method before provider.get() is called. The trick is the same as it already was in Dagger 2.11. It would be nice if you could change this in an upcoming Dagger2 release but in the meanwhile the only workaround is to not try to inject package private types into other classes via member injection or setter-method injection. |
Are you able to create a Minimal, Complete, and Verifiable example that exhibits this behavior? Is this still an issue in 2.23.1? |
Closing this, since there hasn't been a response in over a year. Please open back up if you can provide a Minimal, Complete, and Verifiable example of the issue. |
Generated Dagger component
DaggerComp.java
cannot be compiled, because of this error:Happens using dagger
2.12
. Did not occur in previous versions of dagger (2.11
and earlier)Using AndroidStudio 3.0, Android plugin 3.0.0, Java 8
This issue can be reproduced with following example code:
di/Comp.java
Frag.java
Comp
andPres
must be in different package andPres
is not publicHere is the generated
DaggerComp.java
:The text was updated successfully, but these errors were encountered: