mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8277980: ObjectMethods::bootstrap throws NPE when lookup is null
Reviewed-by: jjg
This commit is contained in:
parent
3893f4f70b
commit
03bf55f620
2 changed files with 4 additions and 3 deletions
|
@ -396,15 +396,15 @@ public class ObjectMethods {
|
||||||
* if invoked by a condy
|
* if invoked by a condy
|
||||||
* @throws IllegalArgumentException if the bootstrap arguments are invalid
|
* @throws IllegalArgumentException if the bootstrap arguments are invalid
|
||||||
* or inconsistent
|
* or inconsistent
|
||||||
* @throws NullPointerException if any argument but {@code lookup} is {@code null},
|
* @throws NullPointerException if any argument is {@code null} or if any element
|
||||||
* in the case of the {@code getters} argument, its
|
* in the {@code getters} array is {@code null}
|
||||||
* contents cannot be {@code null} either
|
|
||||||
* @throws Throwable if any exception is thrown during call site construction
|
* @throws Throwable if any exception is thrown during call site construction
|
||||||
*/
|
*/
|
||||||
public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
|
public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
|
||||||
Class<?> recordClass,
|
Class<?> recordClass,
|
||||||
String names,
|
String names,
|
||||||
MethodHandle... getters) throws Throwable {
|
MethodHandle... getters) throws Throwable {
|
||||||
|
requireNonNull(lookup);
|
||||||
requireNonNull(methodName);
|
requireNonNull(methodName);
|
||||||
requireNonNull(type);
|
requireNonNull(type);
|
||||||
requireNonNull(recordClass);
|
requireNonNull(recordClass);
|
||||||
|
|
|
@ -166,6 +166,7 @@ public class ObjectMethodsTest {
|
||||||
assertThrows(NPE, () -> ObjectMethods.bootstrap(LOOKUP, npt.mn(), npt.mt(), null, "x;y", C.ACCESSORS));
|
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, 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(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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue