RFR: 6260652: (coll) Arrays.asList(x).toArray().getClass() should be Object[].class

Remi Forax forax at univ-mlv.fr
Fri Jun 26 22:46:33 UTC 2015


On 06/26/2015 11:54 PM, Martin Buchholz wrote:
> 10 years later ... still asking for approval to commit.
>
> https://bugs.openjdk.java.net/browse/JDK-6260652
> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Arrays.asList.toArray/

+1

I was bitten once by the dubious implementation of toArray(),
get an ArrayStoreException while tying to store an Object in the 
resulting array.

as a matter of style, i prefer to always have curly braces after an 'if'
and i think that the cast to (Class<T[]>) is no longer needed
(and false if one day generics are fully reified because the right type 
is Class<? extends T[]>).

cheers,
Rémi




More information about the core-libs-dev mailing list