On Mon, 3 Mar 2025 21:44:12 GMT, Sergey Bylokhov <[email protected]> wrote:

> `return (method == null) || isPackageAccessible(method.getDeclaringClass()) ? 
> method : CACHE.create(signature);`
> 
> I think the old code should be read as:
> 
> * If the method is null, skip the h/w package access check and return.
> * If the method is not null, then perform the h/w package access check and 
> duplicate the data if needed.
> 
> So, when the usage of `isPackageAccessible` was deleted, the null check for 
> the method should also have been removed.

When you put it this way, it makes more sense.

As far as I can see, the `method` variable shouldn't be `null`. Yet if the 
package wasn't accessible, the cached value couldn't be returned directly, 
that's why a copy was created.

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

PR Comment: https://git.openjdk.org/jdk/pull/23845#issuecomment-2697008898

Reply via email to