A)
Because super
indicates the lower bounding class of a generic element. So, List super Shape>
could represent List
or List
.
B)
Because the compiler doesn't know what the actual type of List super Shape>
is.
Your adding an object with shapeSuper.add(new Object());
but the compiler only knows that the the generic type of List
is a super type of Shape
but doesn't know exactly witch one it is.
In your example, List super Shape>
could really be List
forcing the compiler to disallow the shapeSuper.add(new Object());
operation.
Remember, Generics are not covariant.