changeset 8262:d921ce805abe

8025610: Add explicit @throws NPE documentation to Optional constructor and Optional.of Reviewed-by: briangoetz, chegar, alanb
author mduigou
date Fri, 27 Sep 2013 17:27:15 -0700
parents 754db1268be1
children 0b535e920dd5
files src/share/classes/java/util/Optional.java
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/Optional.java	Fri Sep 27 17:09:25 2013 -0700
+++ b/src/share/classes/java/util/Optional.java	Fri Sep 27 17:27:15 2013 -0700
@@ -85,6 +85,7 @@
      * 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 @@
      * @param <T> 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 <T> Optional<T> of(T value) {
         return new Optional<>(value);