RFR: JDK-8281003 - MethodHandles::lookup throws NPE if caller is null

Mandy Chung mchung at openjdk.java.net
Mon Feb 14 18:37:09 UTC 2022


On Fri, 11 Feb 2022 20:32:46 GMT, Tim Prinzing <duke at openjdk.java.net> wrote:

> JDK-8281003 - MethodHandles::lookup throws NPE if caller is null

This needs a CSR and the spec needs update.  

The test name could be shortened to `s/exeNullCallerMethodHandlesLookup/exeNullCallerLookup/`.

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");

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

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



More information about the build-dev mailing list