On Mon, 14 Feb 2022 18:28:09 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>> JDK-8281003 - MethodHandles::lookup throws NPE if caller is null
>
> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 121:
> 
>> 119:         Class<?> c = Reflection.getCallerClass();
>> 120:         if (c == null) {
>> 121:             throw new IllegalCallerException();
> 
> Suggestion:
> 
>             throw new IllegalCallerException("no caller frame");

The javadoc needs to be updated to specify this `IllegalCallerException` be 
thrown.


    * @throws IllegalCallerException if there is no caller frame on the stack 
when called
    * directly from a JNI attached thread

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

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

Reply via email to