RFR: 8265135: Reduce work initializing VarForms [v3]

Paul Sandoz psandoz at openjdk.java.net
Wed Apr 14 15:18:39 UTC 2021


On Wed, 14 Apr 2021 11:31:55 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> No, since VarHandles are not publicly extensible, the exception should not occur unless something has gone very wrong (the correspondence between access mode and implementing method is broken).
>
> Unfortunately the change to InternalError breaks a number of tests, since the UOE does bubble up through the public API. I also found a few failing tests I had overlooked due VarHandle.isAccessModeSupported throwing rather than returning false, so I had to slightly rework the patch.

Oops, my bad. I got confused and forgot that VH implementations can avoid implementing access mode methods that would just throw UOE. This slightly complicates lazily resolution.

We don't cache the result of a failed method resolution, which would require a non-null sentinel value, probably does not matter.

Using `resolveOrNull` seems a better fit rather than catching and dropping ROE, less work performed too.

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

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


More information about the core-libs-dev mailing list