On Wed, 14 Apr 2021 11:31:55 GMT, Claes Redestad <redes...@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

Reply via email to