Why does `ScopedValue.where(SCOPE_VALUE, val).call()` throw Exception?
Holo The Sage Wolf
holo3146 at gmail.com
Thu Apr 13 10:23:41 UTC 2023
In a better world, I would suggest modifying the current callable to have
signature `Callable<R, E extends Exception>` to enable a fine grained
exceptions in Today's callable.
Unfortunately while this will have backwards compatibility on the bytecode
level, it will break a lot of code bases.
Of course this problem is not only in callable, it is practically with any
functional interface, maybe it worth making a new package
`java.util.function.exceptionally` that will be similar to
`java.util.function` but with correct exception handling (should I cc the
code-dev mailing list?)
As a side note, generally I'm a bit disappointed from the state of
exceptions with generics in Java, not too long ago I talked about it in (I
believe) the Amber mailing list about possible improvements in the future.
On Thu, Apr 13, 2023, 13:15 Andrew Haley <aph-open at littlepinkcloud.com>
wrote:
> On 4/13/23 09:08, Kasper Nielsen wrote:
> > Not adding more interfaces would of course be preferable.
> > But I would argue that not providing an easy way for working
> > with Throwables for such a low-level tool is the worse solution.
>
> +1. I'm on it.
>
> --
> Andrew Haley (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230413/c12f2e5b/attachment.htm>
More information about the loom-dev
mailing list