diff --git a/src/java.base/share/classes/java/util/Objects.java b/src/java.base/share/classes/java/util/Objects.java index 12f3d297843..7af6b538973 100644 --- a/src/java.base/share/classes/java/util/Objects.java +++ b/src/java.base/share/classes/java/util/Objects.java @@ -319,7 +319,7 @@ public static boolean nonNull( @Nullable Object obj) { * {@code defaultObj} is {@code null} * @since 9 */ - public static T requireNonNullElse(@Nullable T obj, T defaultObj) { + public static T requireNonNullElse(@Nullable T obj, @Nullable T defaultObj) { return (obj != null) ? obj : requireNonNull(defaultObj, "defaultObj"); }