changeset 11342:3ba5b4301f56

8059324: orElseThrow has different signatures for OptionalPrimitive and Optional<T> Reviewed-by: lancea, chegar
author psandoz
date Mon, 02 Feb 2015 14:19:00 +0100
parents 9ee4b68456b6
children ed38ff66f7dd
files src/java.base/share/classes/java/util/OptionalDouble.java src/java.base/share/classes/java/util/OptionalInt.java src/java.base/share/classes/java/util/OptionalLong.java
diffstat 3 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/OptionalDouble.java	Mon Feb 02 14:18:54 2015 +0100
+++ b/src/java.base/share/classes/java/util/OptionalDouble.java	Mon Feb 02 14:19:00 2015 +0100
@@ -182,7 +182,7 @@
      * @throws NullPointerException if no value is present and
      * {@code exceptionSupplier} is null
      */
-    public<X extends Throwable> double orElseThrow(Supplier<X> exceptionSupplier) throws X {
+    public<X extends Throwable> double orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
         if (isPresent) {
             return value;
         } else {
--- a/src/java.base/share/classes/java/util/OptionalInt.java	Mon Feb 02 14:18:54 2015 +0100
+++ b/src/java.base/share/classes/java/util/OptionalInt.java	Mon Feb 02 14:19:00 2015 +0100
@@ -182,7 +182,7 @@
      * @throws NullPointerException if no value is present and
      * {@code exceptionSupplier} is null
      */
-    public<X extends Throwable> int orElseThrow(Supplier<X> exceptionSupplier) throws X {
+    public<X extends Throwable> int orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
         if (isPresent) {
             return value;
         } else {
--- a/src/java.base/share/classes/java/util/OptionalLong.java	Mon Feb 02 14:18:54 2015 +0100
+++ b/src/java.base/share/classes/java/util/OptionalLong.java	Mon Feb 02 14:19:00 2015 +0100
@@ -182,7 +182,7 @@
      * @throws NullPointerException if no value is present and
      * {@code exceptionSupplier} is null
      */
-    public<X extends Throwable> long orElseThrow(Supplier<X> exceptionSupplier) throws X {
+    public<X extends Throwable> long orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
         if (isPresent) {
             return value;
         } else {