Here is the question as presented in chapter 7 of the new SCJP book by Sierra and Bates
I have two problems with the answer. First, I don't understand why C is wrong. My take on <? super E> is that the returned List can by of any super type of E. Since E would be <Integer> then <Number> should work.
My second problem is that in an effort to play with these constructs I made a little program. I can't even get the "correct" versions to work.
Here is the code
Cases A and F give this compiler error
Type mismatch: cannot convert from List<capture-of ? super Integer> to List<Integer>
Case C gives this compiler error
Type mismatch: cannot convert from List<capture-of ? super Integer> to List<Number>
Case E gives this compiler error
Type mismatch: cannot convert from List<capture-of ? super Number> to List<Number>
So as near as I can tell, all of these fail for essentially the same reason but I don't know WHY?
Anyone kind enough to point out where I've run amuck will be most appreciated.
Thanks