RFR: 8344892: beans/finder/MethodFinder.findMethod incorrectly returns null [v3]
Alexey Ivanov
aivanov at openjdk.org
Tue Mar 4 10:37:55 UTC 2025
On Mon, 3 Mar 2025 21:44:12 GMT, Sergey Bylokhov <serb at openjdk.org> 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
More information about the client-libs-dev
mailing list