RFR: 8066869: Add Closeable::closeUnchecked that is the equivalent of close but throws UncheckedIOException

Chen Liang liach at openjdk.org
Fri Jul 7 01:20:54 UTC 2023


On Thu, 6 Jul 2023 20:07:56 GMT, Brian Burkhalter <bpb at 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`.

src/java.base/share/classes/java/io/Closeable.java line 72:

> 70:      * Therefore if an {@linkplain UncheckedIOException} is thrown then its
> 71:      * {@linkplain UncheckedIOException#getCause() getCause} method will return the
> 72:      * {@linkplain IOException} thrown by {@link #close() close}.

These links should all be `@link` as they should be rendered like code like the `{@code IOException}` below.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14789#discussion_r1255091952


More information about the core-libs-dev mailing list