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
We migrated our project from Dagger 2 to kotlin-inject. It's a middle-sized project and the component is successfully generated, but fails to compile. I'm not able to reproduce the issue in a sample, but I can trigger the bug by changing provider methods.
I couldn't find out what triggers the bug as I don't see it with other provided types using the same pattern. But I found two workarounds. The first is removing the second provider method and making the first return the interface type:
(Sidenote here, the code does unnecessary things. The run block and the lateinit var meteredCommunication are redundant.)
The second workaround is adding the property manually to the component:
@Component
interfaceMyComponent {
val meteredCommunication
}
This forces kotlin-inject to implement the property and then it can be referenced successfully in the generated code.
(Another side note with the 2nd workaround. By adding this single line the size of the generated component grows from 9k lines of code to close to 15k, which is very surprising)
The text was updated successfully, but these errors were encountered:
We migrated our project from Dagger 2 to kotlin-inject. It's a middle-sized project and the component is successfully generated, but fails to compile. I'm not able to reproduce the issue in a sample, but I can trigger the bug by changing provider methods.
The class is simple:
With these provider methods:
In the generated component there is this line for another provider method where
MeteredCommunication
is an input:provideMiddlewareEventBus( meteredCommunication = meteredCommunication )
This fails to compile. The argument
meteredCommunication
refers to a property, which doesn't exist. Instead, there is:I couldn't find out what triggers the bug as I don't see it with other provided types using the same pattern. But I found two workarounds. The first is removing the second provider method and making the first return the interface type:
With this the following property will be generated in the component:
(Sidenote here, the code does unnecessary things. The
run
block and thelateinit var meteredCommunication
are redundant.)The second workaround is adding the property manually to the component:
This forces kotlin-inject to implement the property and then it can be referenced successfully in the generated code.
(Another side note with the 2nd workaround. By adding this single line the size of the generated component grows from 9k lines of code to close to 15k, which is very surprising)
The text was updated successfully, but these errors were encountered: