On Fri, 7 Jul 2023 15:56:13 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

>> Add a default method `java.io.Closeable::closeUnchecked` which is equivalent 
>> to `Closeable::close` except that it instead throws 
>> `java.io.UncheckedIOException`.
>
> Brian Burkhalter has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8066869: linkplain -> link

> Add a default method `java.io.Closeable::closeUnchecked` which is equivalent 
> to `Closeable::close` except that it instead throws 
> `java.io.UncheckedIOException`.

I'm not sure about the usefulness of this as it means using try-finally instead 
of try-with-resources. To continue to use try-with-resources would need a new 
interface + some kind of adaptor. Also probably need to think about the code in 
the block. Calls to methods such as read/write will throw IOException so code 
will have to deal with them anyway - maybe you could a migrate a few examples 
using some of the common closeables to see if this is the case.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14789#issuecomment-1629455470

Reply via email to