The occurrence of variance annotations in the type parameter list of a type restricts the places where types can occur within the type declaration.
A type T is output-unsafe if one of the following holds:
A type T is input-unsafe if one of the following holds:
Xi is covariant or invariant and Ai is input-unsafe.
Xi is contravariant or invariant and Ai is output-unsafe.
Intuitively, an output-unsafe type is prohibited in an output position, and an input-unsafe type is prohibited in an input position.
A type is output-safe if it is not output-unsafe, and input-safe if it is not input-unsafe.
Do'stlaringiz bilan baham: |