Suggestion for automatic wrapping of checked exceptions inside RuntimeExceptions inside closures

Behrang Saeedzadeh behrangsa at gmail.com
Fri Apr 28 23:02:00 UTC 2017


No worries. Will post it there.

Thanks.
On Thu, 27 Apr 2017 at 11:18 pm, Martijn Verburg <martijnverburg at gmail.com>
wrote:

> 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
>>
>
> --
Best regards,
Behrang Saeedzadeh


More information about the discuss mailing list