Deprecate CheckedValue.orElseThrow(Supplier) 33/100233/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Mar 2022 11:26:28 +0000 (12:26 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Mar 2022 11:26:28 +0000 (12:26 +0100)
While this method provides seamless transition from/to Optional, its use
results in the original exception being lost. Deprecate it for removal.

Change-Id: I062ee28917f7a1be583077009307f08c57a67acc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/CheckedValue.java

index c1d2d2eca5cb40ed1fc018fa37ea157c3e9dc921..0afa14002a88a55b02a5e0379046f00daa579c6c 100644 (file)
@@ -212,7 +212,9 @@ public class CheckedValue<T, E extends Exception> extends Either<T, E> {
      * @return Contained value
      * @throws NullPointerException if {@code exceptionMapper} is null
      * @throws X When there is no contained value
+     * @deprecated This method is losing the underlying failure cause. Use {@link #orElseThrow(Function)} instead.
      */
+    @Deprecated(forRemoval = true, since = "8.0.2")
     public final <X extends Throwable> T orElseThrow(final Supplier<X> supplier) throws X {
         requireNonNull(supplier);
         if (isFirst()) {