RFR: 8265135: Reduce work initializing VarForms

Paul Sandoz psandoz at openjdk.java.net
Wed Apr 14 00:48:59 UTC 2021


On Wed, 14 Apr 2021 00:35:38 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/VarForm.java line 130:
>> 
>>> 128:         } catch (NoSuchMethodException | IllegalAccessException e) {
>>> 129:             throw new UnsupportedOperationException();
>>> 130:         }
>> 
>> Suggestion:
>> 
>>         } catch (ReflectiveOperationException e) {
>>                 throw newInternalError("Failed resolving VarHandle member name", ex);
>>         }
>
> Thanks for reviewing!
> 
> Is there's a way to provoke this exception through the public API? If not then the suggested behavior change seems reasonable.

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).

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

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


More information about the core-libs-dev mailing list