Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8277980: ObjectMethods::bootstrap throws NPE when lookup is null
Reviewed-by: jjg
  • Loading branch information
Vicente Romero committed Dec 8, 2021
1 parent 3893f4f commit 03bf55f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -396,15 +396,15 @@ private static List<List<MethodHandle>> split(MethodHandle[] getters) {
* 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 {
requireNonNull(lookup);
requireNonNull(methodName);
requireNonNull(type);
requireNonNull(recordClass);
Expand Down
1 change: 1 addition & 0 deletions test/jdk/java/lang/runtime/ObjectMethodsTest.java
Expand Up @@ -166,6 +166,7 @@ record NamePlusType(String mn, MethodType mt) {}
assertThrows(NPE, () -> ObjectMethods.bootstrap(LOOKUP, npt.mn(), npt.mt(), null, "x;y", C.ACCESSORS));
assertThrows(NPE, () -> ObjectMethods.bootstrap(LOOKUP, npt.mn(), null, C.class, "x;y", C.ACCESSORS));
assertThrows(NPE, () -> ObjectMethods.bootstrap(LOOKUP, null, npt.mt(), C.class, "x;y", C.ACCESSORS));
assertThrows(NPE, () -> ObjectMethods.bootstrap(null, npt.mn(), npt.mt(), C.class, "x;y", C.ACCESSORS));
}
}

Expand Down

1 comment on commit 03bf55f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.