Array Covariance vs. Generic Invariance

Java’s type system disagrees with itself about one question: if String is an Object, is String[] an Object[]? Arrays say yes. Generics say absolutely not. Both answers were deliberate. Here’s a line of Java that compiles without a single warning: Object[] objects = new String[3];. And here’s a line that doesn’t even get that far: List<Object> list …