I have a class declared as Query<out T : Any>. Then I have this method:
fun bindFoo(liveData: LiveData<Query<*>>) {...}
Let’s say I have val liveData: LiveData<Query<List<String>>> and I call the method like bindFoo(liveData):
I get a compiler error saying
Required:
LiveData<Query<*>>
Found:
LiveData<Query<List<String>>>
Docs say that:
For
Foo<out T : TUpper>, whereTis a covariant type parameter with the upper boundTUpper,Foo<*>is equivalent toFoo<out TUpper>.
I can’t really understand why the star projection is not allowed in this case. Isn’t List<String> a subtype of Any?
If I changed the method signature to:
fun <T : Any> bindFoo(liveData: LiveData<Query<T>>) {...}
then the compiler error goes away.
What am I missing?