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

Glavo duke at openjdk.org
Mon Jan 30 03:16:17 UTC 2023


On Mon, 30 Jan 2023 03:09:53 GMT, Tingjun Yuan <duke at openjdk.org> wrote:

>>> Why not use set of classes?
>> 
>> Because some classes are not visible here (such as `Arrays.ArrayList`). 
>> 
>> I'm not sure what the best choice is, so I'm trying to explore the implementation plan.
>
>> > Why not use set of classes?
>> 
>> Because some classes are not visible here (such as `Arrays.ArrayList`).
>> 
>> I'm not sure what the best choice is, so I'm trying to explore the implementation plan.
> 
> Only `Arrays.ArrayList` is not visible here.  You can change it into package-private.

> > > Why not use set of classes?
> > 
> > 
> > Because some classes are not visible here (such as `Arrays.ArrayList`).
> > I'm not sure what the best choice is, so I'm trying to explore the implementation plan.
> 
> Only `Arrays.ArrayList` is not visible here. You can change it to package-private.

Another problem is that use set of classes may cause unnecessary classes to be loaded, which has a negative impact on startup speed. I want to do some tests in the next few days.

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

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


More information about the core-libs-dev mailing list