-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b142
In Optional, the signature of flatMap() should be changed as follows:
OLD: <U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper)
NEW: <U> Optional<U> flatMap(Function<? super T, Optional<? extends U>> mapper)
The signature of or() should be changed as follows:
OLD: Optional<T> or(Supplier<Optional<T>> supplier)
NEW: Optional<T> or(Supplier<Optional<? extends T>> supplier)
This will alleviate some restrictions on the mapper and supplier functions.
Some compatibility analysis should be done on flatMap() because it was originally defined in Java 8. The or() method is new in Java 9 so there should be no compatibility impact.
OLD: <U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper)
NEW: <U> Optional<U> flatMap(Function<? super T, Optional<? extends U>> mapper)
The signature of or() should be changed as follows:
OLD: Optional<T> or(Supplier<Optional<T>> supplier)
NEW: Optional<T> or(Supplier<Optional<? extends T>> supplier)
This will alleviate some restrictions on the mapper and supplier functions.
Some compatibility analysis should be done on flatMap() because it was originally defined in Java 8. The or() method is new in Java 9 so there should be no compatibility impact.
- relates to
-
JDK-8132097 Stream.generate should use a covariant Supplier as parameter
-
- Resolved
-