RFR: 8066869: Add Closeable::closeUnchecked that is the equivalent of close but throws UncheckedIOException
Roger Riggs
rriggs at openjdk.org
Thu Jul 6 20:44: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 60:
> 58: * with it. If the stream is already closed then invoking this
> 59: * method has no effect.
> 60: *
Can you add an example showing the recommended pattern of use?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14789#discussion_r1254898461
More information about the core-libs-dev
mailing list