You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You have a class and subclass that both inject something with @Inject
Both of those classes are in separate modules that only run anvil (with factory generation)
You attempt to get a MembersInjector for that class
Build will fail with incompatible types exception. It seems like the order of parameters in MembersInjector generated by Anvil is not the same as expected by Dagger.
This situation seems weirdly specific at first, but getting MembersInjector strategy is used by Whestone to allow activity injection. Concretely, this bug means that we cannot have an activity where both actual activity and its parent class inject things independently.
The text was updated successfully, but these errors were encountered:
matejdro
added a commit
to matejdro/anvil
that referenced
this issue
Jul 17, 2023
When list of fields is fetched in com.squareup.anvil.compiler.codegen.dagger.DaggerGenerationUtils#declaredMemberInjectParameters, properties will list properties in the wrong order.
This only happens when base class is in another module and this = ClassReference.Descriptor. When class is in the same module, this = ClassReference.Psi the order is correct.
I would appreciate some help with reporting this upstream to Kotlin, since I'm not sure what exactly is happening behind the scenes to make a proper report.
By the way, I made a simple test for this issue here for even easier reproduce: matejdro@df9e78a
matejdro
changed the title
Getting MembersInjector fails when both parent and subclass have Inject fields
Getting MembersInjector's constructor has wront parameter order when base class with @Inject fields is in another module
Jul 17, 2023
matejdro
changed the title
Getting MembersInjector's constructor has wront parameter order when base class with @Inject fields is in another module
MembersInjector's constructor has wront parameter order when base class with @Inject fields is in another module
Jul 17, 2023
matejdro
changed the title
MembersInjector's constructor has wront parameter order when base class with @Inject fields is in another module
MembersInjector's constructor has wrong parameter order when base class with @Inject fields is in another module
Jul 17, 2023
When:
@Inject
MembersInjector
for that classBuild will fail with
incompatible types
exception. It seems like the order of parameters in MembersInjector generated by Anvil is not the same as expected by Dagger.Steps to reproduce:
Run this test: matejdro@df9e78a
OR
./gradlew assembleDebug
This situation seems weirdly specific at first, but getting MembersInjector strategy is used by Whestone to allow activity injection. Concretely, this bug means that we cannot have an activity where both actual activity and its parent class inject things independently.
The text was updated successfully, but these errors were encountered: