Summary
The specification for method java.lang.runtime.ObjectMethods::bootstrap
should be updated regarding the cases for which NPE is thrown.
Problem
NPE is thrown by method java.lang.runtime.ObjectMethods::bootstrap
if argument lookup
is null
but the specification says otherwise
Solution
Update the method specification for method java.lang.runtime.ObjectMethods::bootstrap
specifying that NPE is thrown if any argument is null
Specification
diff --git a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java
index 5d092328f75..133d75b1f7f 100644
--- a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java
+++ b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java
@@ -396,15 +396,15 @@ private static MethodHandle makeToString(MethodHandles.Lookup lookup,
* if invoked by a condy
* @throws IllegalArgumentException if the bootstrap arguments are invalid
* or inconsistent
- * @throws NullPointerException if any argument but {@code lookup} is {@code null},
- * in the case of the {@code getters} argument, its
- * contents cannot be {@code null} either
+ * @throws NullPointerException if any argument is {@code null} or if any element
+ * in the {@code getters} array is {@code null}
* @throws Throwable if any exception is thrown during call site construction
*/
public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
Class<?> recordClass,
String names,
MethodHandle... getters) throws Throwable {
- csr of
-
JDK-8277980 ObjectMethods::bootstrap throws NPE when lookup is null
-
- Closed
-
- relates to
-
JDK-8261847 performance of java.lang.Record::toString should be improved
-
- Resolved
-
- links to
-
Review openjdk/jdk/6754