(correction) Re : small ideas to improve java
Ahmed mazher
ah_mz_el2003 at yahoo.com
Tue Aug 16 07:20:37 UTC 2016
On 15.08.2016 21:36, i wrote:>also it appear to me that currently arrays of parameterized type are
>nonvariant e.g
>Box<Integer>[] ints = new Box[10];
>Box<Number>[] nums = ints;//not allowed
>as in contrast to usual arrays
>Number[] ns = new Integer[10];
>Box<? extends Number>[] nums = ints;//allowed ? really getting messy
i was wrong sorry for this
Box<Integer> not subtype of Box<Number> but is subtype of Box<? extends
Number> so my assumption that arrays of parameterized type are partially
invariant is completely wrong
but i still requesting it been partially invariant by at least raising
warning as i described previously
Best regards,
ahmed mazher
More information about the adoption-discuss
mailing list