On Thu, 19 Jan 2023 18:41:08 GMT, Markus KARG <[email protected]> wrote:
> ImageIO objects, like ImageReader, ImageWrite, ImageInputStream and
> ImageOutputStream, should implement AutoClosable.
>
> There is a risk of keeping resources opened longer than needed (or even run
> into a resource leak with long running processes) as the user cannot use
> try-with-resources currently. The fact that there is a `dispose()` method to
> be called is easily missed, as people tend to look for `close()`.
>
> This is not a big change, but it is useful for those working with ImageIO.
src/java.desktop/share/classes/javax/imageio/ImageReader.java line 2883:
> 2881: * @implNote The default implementation of this method invokes
> {@link #dispose()}.
> 2882: */
> 2883: public void close() {
(Not a reviewer) I think we need to add the `@since` tag to javadoc.
-------------
PR: https://git.openjdk.org/jdk/pull/12098