8059324: orElseThrow has different signatures for OptionalPrimitive and Optional<T>
authorpsandoz
Mon, 02 Feb 2015 14:19:00 +0100
changeset 28753 764648da0e46
parent 28752 9c115a7527c9
child 28754 8fe59917548d
8059324: orElseThrow has different signatures for OptionalPrimitive and Optional<T> Reviewed-by: lancea, chegar
jdk/src/java.base/share/classes/java/util/OptionalDouble.java
jdk/src/java.base/share/classes/java/util/OptionalInt.java
jdk/src/java.base/share/classes/java/util/OptionalLong.java
--- a/jdk/src/java.base/share/classes/java/util/OptionalDouble.java	Mon Feb 02 14:18:54 2015 +0100
+++ b/jdk/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/jdk/src/java.base/share/classes/java/util/OptionalInt.java	Mon Feb 02 14:18:54 2015 +0100
+++ b/jdk/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/jdk/src/java.base/share/classes/java/util/OptionalLong.java	Mon Feb 02 14:18:54 2015 +0100
+++ b/jdk/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 {