Difference of assignability with nested wildcards in Java 7/8 generics
The following compiles just fine in JDK8, but gives an incompatible types error with JDK7. List<List<? extends Number>> xs = Arrays.asList(Arrays.asList(0)); According to this answer , List<List<? extends Number>> doesn't have a supertype relationship to List<List<Integer>> . What changed in Java 8 that made this assignment work? I'm also having a hard time understanding why it doesn't work in Java 7. Both of these statements compile without type error using JDK7: List<? extends Number> xs = Arrays.asList(0); List<? extends List<? extends Number>> ys = Arrays.asList(Arrays.asList(0)); It seems