Cannot resolve generic type in Kotlin using variance operator Out
I have a case where a interface SubscriptionService
have a generic type <T: SubscriptionPatch>
. Following, I have a service that injects all implementations of SubscriptionService
in a list, but Spring cannot resolve theses dependencies without variance operator out
. Using out
operator solve the problem, but I can’t call functions with parameters of generic type (out
restricts the generic only to output type). Example code: