Skip to content

Commit 44374a5

Browse files
gustavosimonRealCLanger
authored andcommitted
8350542: Optional.orElseThrow(Supplier) does not specify behavior when supplier returns null
Reviewed-by: liach, clanger
1 parent e4cb49f commit 44374a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/java.base/share/classes/java/util/Optional.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ public T orElseThrow() {
394394
* @return the value, if present
395395
* @throws X if no value is present
396396
* @throws NullPointerException if no value is present and the exception
397-
* supplying function is {@code null}
397+
* supplying function is {@code null} or produces a {@code null} result
398398
*/
399399
public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
400400
if (value != null) {

0 commit comments

Comments
 (0)