diff --git a/src/share/classes/java/util/Optional.java b/src/share/classes/java/util/Optional.java index ce2a33d1de68c915502027ee5ff38672d0a93747..10b79234b18da5e441f54064dc5b750d0dca55be 100644 --- a/src/share/classes/java/util/Optional.java +++ b/src/share/classes/java/util/Optional.java @@ -85,6 +85,7 @@ public final class Optional { * Constructs an instance with the value present. * * @param value the non-null value to be present + * @throws NullPointerException if value is null */ private Optional(T value) { this.value = Objects.requireNonNull(value); @@ -96,6 +97,7 @@ public final class Optional { * @param the class of the value * @param value the value to be present, which must be non-null * @return an {@code Optional} with the value present + * @throws NullPointerException if value is null */ public static Optional of(T value) { return new Optional<>(value);