Suggestion for automatic wrapping of checked exceptions inside RuntimeExceptions inside closures

Martijn Verburg martijnverburg at gmail.com
Thu Apr 27 13:18:07 UTC 2017


Hi Behrang,

This is the wrong list to bring up proposals like this - a good place to
start is the adoption-discuss mailing list.

Cheers,
Martijn

On 27 April 2017 at 14:10, 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
>


More information about the discuss mailing list