RFR: 8301220: Return value of toArray() of Сollection types from java.base should be trusted

Glavo duke at openjdk.org
Fri Jan 27 09:45:04 UTC 2023


On Fri, 27 Jan 2023 09:35:00 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

> @Glavo I've filed https://bugs.openjdk.org/browse/JDK-8301220 so you can use it for this PR.

Thank you!

> I think as soon as we anyway assign the array from trusted collection, we don't need `len == 0` check here any more

I think it is necessary to check the length here. 

If the length of the current COWArrayList is not zero, it is necessary to copy the elements to a larger new array.

-------------

PR: https://git.openjdk.org/jdk/pull/12212


More information about the core-libs-dev mailing list