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
The most confusing thing is that on my company's project this code works just perfectly. The difference is that the codebase is big, it has many modules, many dependencies, some of which are not the latest.
If I use @Provides instead of @Binds and cast the parameter manually to AssistedViewModelFactory<out ViewModel, in ViewModelArgument>, it works as well.
@Provides
@IntoMap
@ViewModelKey(PasswordViewModel::class)
fun passwordViewModelFactory(factory: PasswordViewModel.Factory): AssistedViewModelFactory<out ViewModel, in ViewModelArgument> {
return factory as AssistedViewModelFactory<out ViewModel, in ViewModelArgument>
}
If I remove the second type from AssistedViewModelFactory<out ViewModel, in ViewModelArgument>, the ViewModelArgument, it works as well.
What I have tried:
downgrading all kinds of dependencies and plugins (kotlin, gradle, gradle android, dagger) in the sample project, upgrading them in the company's project (still worked), spamming @JvmSuppressWildcards right and left, checking for differences in the related code, checking the generated code and decompiled java code.
All the dagger code seems to be generated properly.
Might be related to #1143
Could it be due to race conditions between javac and kapt?
The text was updated successfully, but these errors were encountered:
The goal was to provide custom generic argument to the ViewModel through Dagger using AssistedInject.
This is the reproducible sample android app: https://github.com/deividasstr/ViewModel-argument-inject
While building the project I get:
Binding method:
Here, the return type is
AssistedViewModelFactory
, which isAnd
ViewModelArgument
is justabstract class ViewModelArgument
.ViewModel is android architecture component.
The
PasswordViewModel.Factory
isThe most confusing thing is that on my company's project this code works just perfectly. The difference is that the codebase is big, it has many modules, many dependencies, some of which are not the latest.
If I use
@Provides
instead of@Binds
and cast the parameter manually toAssistedViewModelFactory<out ViewModel, in ViewModelArgument>
, it works as well.If I remove the second type from
AssistedViewModelFactory<out ViewModel, in ViewModelArgument>
, theViewModelArgument
, it works as well.What I have tried:
downgrading all kinds of dependencies and plugins (kotlin, gradle, gradle android, dagger) in the sample project, upgrading them in the company's project (still worked), spamming
@JvmSuppressWildcards
right and left, checking for differences in the related code, checking the generated code and decompiled java code.All the dagger code seems to be generated properly.
Might be related to #1143
Could it be due to race conditions between javac and kapt?
The text was updated successfully, but these errors were encountered: