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

Sergey Tsypanov stsypanov at openjdk.org
Fri Jan 27 18:18:19 UTC 2023


On Fri, 27 Jan 2023 14:28:08 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> It might be better to focus on a few specific cases that can be proven to be safe

As of trusted collections from java.base we have
- ArrayList
- Arrays.asList()
- HashSet
- LinkedHashSet
- TreeSet
- EnumSet
- ArrayDeque
- COWArrayList
- ConcurrentLinkedDeque
- Key/Value/EntrySets of Maps

Wouldn't it be too expensive to check whether incoming Collection's class is one of the enlisted?

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

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


More information about the core-libs-dev mailing list