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

Ivan Gerasimov ivan.gerasimov at oracle.com
Sat Jun 27 13:43:23 UTC 2015


Hi Martin!

Would it make sense to add a simple regression test with this fix?

I guess, something like the following should suffice:

--------------------------------
import java.util.Arrays;
public class Test {
     public static void main(String[] args) throws Throwable {
         Arrays.asList(new String[] {"42"}).toArray(new Object[0])[0] = 
new Integer(42);
         Arrays.asList(new String[] {"42"}).toArray()[0] = new Integer(42);
     }
}
--------------------------------

Sincerely yours,
Ivan

On 27.06.2015 0:54, 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/ 
> <http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk9/Arrays.asList.toArray/>




More information about the core-libs-dev mailing list