Suggestion for automatic wrapping of checked exceptions inside RuntimeExceptions inside closures

Martijn Verburg martijnverburg at gmail.com
Mon May 1 15:15:13 UTC 2017


Hi Behrang,

In order to contribute something like this to OpenJDK, it's generally
requested that you discuss the semantics of the proposal in the correct
mailing list, especially before any before any discussion on syntax :-).
If you can formally write this idea up with the semantic interactions of
how this automatic wrapping will work and the benefit it might bring to
this list then there's a few folks who can help critique it before moving
onto core-libs or valhalla-dev.

Cheers,
Martijn

On 29 April 2017 at 00:04, Behrang Saeedzadeh <behrangsa at gmail.com> wrote:

> Hi,
>
> This has most likely been discussed before. In this yet another proposal, I
> suggest adding syntax sugar to make this automated. For example, by using a
> new arrow type (e.g. =>, #->, or maybe a new operator altogether: (╯°□°)╯︵
> ┻━┻).
>
> So we can turn:
>
> public class Main {
>     public static void main(String[] args) throws IOException {
>         final Path aDir = Paths.get(args[0]);
>         Files.list(aDir).forEach(f -> {
>             try {
>                 throw new IOException();
>             } catch (IOException e) {
>                 throw new RuntimeException(e);
>             }
>         });
>     }
> }
>
>
> into:
>
> public class Main {
>     public static void main(String[] args) throws IOException {
>         final Path aDir = Paths.get(args[0]);
>         Files.list(aDir).forEach(f (╯°□°)╯︵ ┻━┻ {
>             throw new IOException();
>         });
>     }
> }
>
> What do you think?
>
>
> Best regards,
> Behrang Saeedzadeh
> --
> Best regards,
> Behrang Saeedzadeh
>


More information about the adoption-discuss mailing list