RFR: 8285007: Use correct lookup mode for MethodHandleStatics.UNSAFE

Paul Sandoz psandoz at openjdk.java.net
Tue Apr 19 16:23:24 UTC 2022


On Tue, 19 Apr 2022 13:19:31 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> Trivially fix the resolution of the `NF_UNSAFE` named function to use the appropriate lookup mode.
> 
> In [JDK-8187826](https://bugs.openjdk.java.net/browse/JDK-8187826) we changed from regular reflection to use a `NamedFunction` for this field, but it appears the lookup mode came out wrong. This mismatch appears to be benign and ignored by HotSpot, but a user implementing an experimental JVM ran into some issues (and additionally noticed the resolve throws the wrong exception). 
> 
> This patch is a point fix to this particular issue, but I think we should consider following up with a stronger assertion or test for proper staticness of fields somewhere when resolving fields via `MemberName.getFactory().resolveOrNull(..)`.

Marked as reviewed by psandoz (Reviewer).

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

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


More information about the core-libs-dev mailing list