@@ -292,7 +292,7 @@ public static Try<Unit> trying(CheckedRunnable<?> runnable) {
292292 @ SuppressWarnings ("try" )
293293 public static <A extends AutoCloseable , B > Try <B > withResources (
294294 CheckedSupplier <? extends Exception , A > aSupplier ,
295- CheckedFn1 <? extends Exception , ? super A , ? extends Try <? extends B >> fn ) {
295+ CheckedFn1 <?, ? super A , ? extends Try <? extends B >> fn ) {
296296 return trying (() -> {
297297 try (A resource = aSupplier .get ()) {
298298 return fn .apply (resource ).<B >fmap (upcast ());
@@ -316,7 +316,8 @@ public static <A extends AutoCloseable, B extends AutoCloseable, C> Try<C> withR
316316 CheckedSupplier <? extends Exception , ? extends A > aSupplier ,
317317 CheckedFn1 <? extends Exception , ? super A , ? extends B > bFn ,
318318 CheckedFn1 <? extends Exception , ? super B , ? extends Try <? extends C >> fn ) {
319- return withResources (aSupplier , a -> withResources (() -> bFn .apply (a ), fn ::apply ));
319+ CheckedFn1 <Throwable , A , Try <? extends C >> checkedFn = a -> withResources (() -> bFn .apply (a ), fn ::apply );
320+ return withResources (aSupplier , checkedFn );
320321 }
321322
322323 /**
@@ -339,7 +340,8 @@ public static <A extends AutoCloseable, B extends AutoCloseable, C extends AutoC
339340 CheckedFn1 <? extends Exception , ? super A , ? extends B > bFn ,
340341 CheckedFn1 <? extends Exception , ? super B , ? extends C > cFn ,
341342 CheckedFn1 <? extends Exception , ? super C , ? extends Try <? extends D >> fn ) {
342- return withResources (aSupplier , bFn , b -> withResources (() -> cFn .apply (b ), fn ::apply ));
343+ CheckedFn1 <Exception , B , Try <? extends D >> checkedFn = b -> withResources (() -> cFn .apply (b ), fn ::apply );
344+ return withResources (aSupplier , bFn , checkedFn );
343345 }
344346
345347 private static final class Failure <A > extends Try <A > {
0 commit comments