On Tue, 5 Aug 2025 21:17:36 GMT, Phil Race <p...@openjdk.org> wrote: > This PR removes javax/imageio/stream/ImageInputStreamImpl.finalize() > As a result, sub-classes which over-ride it to be empty no longer need to do > so. > Also it means that the 2 remaining classes which used it no longer can. > FileCacheImageOutputStream will have its cache cleaned up by a disposer. > The impact on applications is that they, or the ImageWriter may need to call > flush() IF they relied on finalization. > However that should be extremely unlikely given that finalization will happen > far too late in most cases, and is > really meant to clean up internal resources. > The JDK's GIF and TIFF image writers don't flush themselves, so applications > which use these together with one of these caching streams would have learned > this already. > > The principal outside risk is to 3rd party ImageIO stream subclasses which > both allocate native resources and rely on finalization as a backstop clean > up in case applications forget to call close. But it will be the applications > that are affected if the resource is depleted. > The risks of this will be covered in the CSR. > > There's also a lengthy write up in the JBS issue.
Changes requested by bchristi (Reviewer). src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java line 275: > 273: //cache.close(); > 274: cache = null; > 275: //cacheFile.delete(); Remove commented code? src/java.desktop/share/classes/javax/imageio/stream/package-info.java line 48: > 46: * of sequences of bytes that reduces the amount of internal data copying. > 47: * <p> > 48: * An {@code ImageInputStream} or {@code ImageInputStream} may internally > allocate "...or Image**Output**Stream..." ? ------------- PR Review: https://git.openjdk.org/jdk/pull/26650#pullrequestreview-3093759313 PR Review Comment: https://git.openjdk.org/jdk/pull/26650#discussion_r2258082917 PR Review Comment: https://git.openjdk.org/jdk/pull/26650#discussion_r2257961502