Condition is a generic class which is invariant on its type parameter. It means that even if
A is a supertype of
Condition<A> is neither supertype nor subtype of
Condition<B>. I suppose
ObservableList is some generic class/interface written in Java, so it’s invariant on its type parameter too (because all generic classes are invariant in Java).
In your example,
Condition<*> is equivalent to
Condition<out Any?>, so
Condition<T> is definitely its subtype. But since
ObservableList is invariant,
ObservableList<Condition<T>> is not a subtype of
ObservableList<Condition<*>> and thus cannot be assigned to
I suppose you cannot alter
ObservableList declaration to add declaration site variance, so you may want to specify use site variance instead on the
var myList: ObservableList<out Condition<*>>
I recommend reading the section about generic variance to better grasp these concepts.