@@ -323,26 +323,24 @@ public static <L, R> Either<L, R> fromMaybe(Maybe<R> maybe, Supplier<L> leftFn)
323323 *
324324 * @param supplier the supplier of the right value
325325 * @param leftFn a function mapping E to L
326- * @param <T> the most contravariant exception that the supplier might throw
327326 * @param <L> the left parameter type
328327 * @param <R> the right parameter type
329328 * @return the supplier result as a right value, or leftFn's mapping result as a left value
330329 */
331- public static <T extends Throwable , L , R > Either <L , R > trying (CheckedSupplier <T , ? extends R > supplier ,
332- Function <? super T , ? extends L > leftFn ) {
333- return Try .<T , R >trying (supplier ::get ).toEither (leftFn );
330+ public static <L , R > Either <L , R > trying (CheckedSupplier <? , ? extends R > supplier ,
331+ Function <? super Throwable , ? extends L > leftFn ) {
332+ return Try .<Throwable , R >trying (supplier ::get ).toEither (leftFn );
334333 }
335334
336335 /**
337336 * Attempt to execute the {@link CheckedSupplier}, returning its result in a right value. If the supplier throws an
338337 * exception, wrap it in a left value and return it.
339338 *
340339 * @param supplier the supplier of the right value
341- * @param <T> the left parameter type (the most contravariant exception that supplier might throw)
342340 * @param <R> the right parameter type
343341 * @return the supplier result as a right value, or a left value of the thrown exception
344342 */
345- public static <T extends Throwable , R > Either <T , R > trying (CheckedSupplier <T , R > supplier ) {
343+ public static <R > Either <Throwable , R > trying (CheckedSupplier <? , R > supplier ) {
346344 return trying (supplier , id ());
347345 }
348346
@@ -352,12 +350,11 @@ public static <T extends Throwable, R> Either<T, R> trying(CheckedSupplier<T, R>
352350 *
353351 * @param runnable the runnable
354352 * @param leftFn a function mapping E to L
355- * @param <T> the most contravariant exception that the runnable might throw
356353 * @param <L> the left parameter type
357354 * @return {@link Unit} as a right value, or leftFn's mapping result as a left value
358355 */
359- public static <T extends Throwable , L > Either <L , Unit > trying (CheckedRunnable <T > runnable ,
360- Function <? super T , ? extends L > leftFn ) {
356+ public static <L > Either <L , Unit > trying (CheckedRunnable <? > runnable ,
357+ Function <? super Throwable , ? extends L > leftFn ) {
361358 return Try .trying (runnable ).toEither (leftFn );
362359 }
363360
@@ -366,10 +363,9 @@ public static <T extends Throwable, L> Either<L, Unit> trying(CheckedRunnable<T>
366363 * exception, wrap it in a left value and return it.
367364 *
368365 * @param runnable the runnable
369- * @param <T> the left parameter type (the most contravariant exception that runnable might throw)
370366 * @return {@link Unit} as a right value, or a left value of the thrown exception
371367 */
372- public static < T extends Throwable > Either <T , Unit > trying (CheckedRunnable <T > runnable ) {
368+ public static Either <Throwable , Unit > trying (CheckedRunnable <? > runnable ) {
373369 return trying (runnable , id ());
374370 }
375371
0 commit comments