On Mon, 2 May 2022 16:19:07 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>> `Class.getInterfaces(false)` does not clone underlying array and can be used 
>> in cases when the returned array is only read from.
>
> For the `checkPackageAccess` case, I don't think it worths fixing; not only 
> that security manager is deprecated for removal but also when security 
> manager is enabled, there are lots of allocations for other security checks.
> 
> So the `getInterface(boolean)` method can be kept private.

I agree with @mlchung that the call site in `ClassLoader` is not particularly 
interesting and doesn't motivate a non-cloning, trusted method. There are a few 
other places in java.base where it's used and a trusted method could help, but 
not sure any of those are performance critical.

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

PR: https://git.openjdk.java.net/jdk/pull/7714

Reply via email to