On Fri, 27 Jan 2023 13:53:45 GMT, Glavo <d...@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.
>
> Glavo has updated the pull request incrementally with one additional commit 
> since the last revision:
> 
>   Collections.isTrustedCollection

I skimmed through the latest update. I see you've considered the possibility of 
a Matryoshka doll showing up but the optimization is still very very scary. I 
think it would require an audit of every API in java.base that potentially 
wraps a collection. It might be better to focus on a few specific cases that 
can be proven to be safe.

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

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

Reply via email to