RFR Passing 'null' value to lookup param of ConstantBootstraps.invoke does not throw NullPointerException

Paul Sandoz paul.sandoz at oracle.com
Tue Feb 20 22:47:51 UTC 2018


Hi,

Correction to the specification of ConstantBootstraps.invoke [1], the lookup parameter is not used:

diff -r b75c9e2e3b1f src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java
--- a/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java	Tue Feb 20 21:47:54 2018 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java	Tue Feb 20 14:38:56 2018 -0800
@@ -209,8 +209,7 @@
      * Returns the result of invoking a method handle with the provided
      * arguments.
      *
-     * @param lookup the lookup context describing the class performing the
-     * operation (normally stacked by the JVM)
+     * @param lookup unused
      * @param name unused
      * @param type the type of the value to be returned, which must be
      * compatible with the return type of the method handle


CSR is here:

  https://bugs.openjdk.java.net/browse/JDK-8198469

Paul.

[1]
/**
 * Returns the result of invoking a method handle with the provided
 * arguments.
 *
 * @param lookup unused
 * @param name unused
 * @param type the type of the value to be returned, which must be
 * compatible with the return type of the method handle
 * @param handle the method handle to be invoked
 * @param args the arguments to pass to the method handle, as if with
 * {@link MethodHandle#invokeWithArguments}.  Each argument may be
 * {@code null}.
 * @return the result of invoking the method handle
 * @throws WrongMethodTypeException if the handle's return type cannot be
 * adjusted to the desired type
 * @throws ClassCastException if an argument cannot be converted by
 * reference casting
 * @throws Throwable anything thrown by the method handle invocation
 */
public static Object invoke(MethodHandles.Lookup lookup, String name, Class<?> type,
                            MethodHandle handle, Object... args) throws Throwable {


More information about the core-libs-dev mailing list