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

Paul Sandoz paul.sandoz at oracle.com
Wed Jul 8 07:59:36 UTC 2015


HI Martin,

Sorry the late reply.


On Jun 30, 2015, at 7:04 PM, Martin Buchholz <martinrb at google.com> wrote:
> 
> The comment remains correct even if 6260652 is fixed.
> I can't think up a clearly better one.

I would recommend at least removing the issue id (since that refers specifically to Arrays.asList rather than something general that cannot actually be fixed). Up to you.


> 
> I trawled through the JDK code and found one other violation of the toArray contract in:
> 
>   com.sun.java.util.jar.pack.ConstantPool.Index:
> 
>   public Entry[] toArray() {
>       return toArray(new Entry[size()]);
>   }
> 
> Agreed.  I'm unfamiliar with that code - it should probably be fixed in another change.

Logged:

  https://bugs.openjdk.java.net/browse/JDK-8130732

Paul.



More information about the core-libs-dev mailing list