I am trying to use Errors class of Durian library, for catching checked exceptions in lambda functions of Java 8.
I wrote simple function:
void eat(NsiItemInfoType food) throws CantUpdNSI {}
And trying to call it:
this code works well:
res.getNsiList().getNsiItemInfo().stream().forEach(Errors.rethrow().wrap(this:: eat) );
But this code invokes compiler error The method wrap(Throwing.Function) is ambiguous for the type Errors.Rethrowing
res.getNsiList().getNsiItemInfo().stream().forEach(Errors.rethrow().wrap(t -> eat(t)) );
I can't understand why.
I got examples from here: https://github.com/diffplug/durian/blob/v2.0/test/com/diffplug/common/base/ErrorsExample.java
Durian version: com.diffplug.durian 3.4.0