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

Alan Bateman alanb at openjdk.org
Fri Jan 27 11:38:18 UTC 2023


On Thu, 26 Jan 2023 06:46:16 GMT, Glavo <duke at openjdk.org> wrote:

> I checked the `java.base` module, and all the `Collection#toArray()` method of collections be implemented correctly.
> 
> Their return values can be trusted, so many unnecessary array duplication can be eliminated.

What about Collections.synchronizedCollection and other methods that may wrap/delagete to collections from other modules?

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

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


More information about the core-libs-dev mailing list