Make DeserializationStrategy covariant at declaration-site
The type parameter T of DeserializationStrategy only appears in an out position, namely as the return type of deserialize().
It can therefore be annotated with out to increase API flexibility compared to DeserializationStrategy being invariant.
E.g. a function taking DeserializationStrategy<Number> would now also accept an object of type DeserializationStrategy<Int>.
This would also result in DeserializationStrategy being more similar to the symmetric SerializationStrategy interface which is already contravariant at declaration-site (interface SerializationStrategy<in T>), SerializationStrategy is a consumer, DeserializationStrategy a producer.
This change is
- [x] binary backwards compatible: generics are erased at runtime
- [x] source backwards compatible: previously specified
outprojections (use-site covariance) will only report a warning about a redundant projection
Please tell me when there is a reason why this shouldn't be changed or wasn't changed before, maybe I'm missing something.