Proposal: 8302281 - ImageReader and ImageWrite should implement Closable
Markus Karg
markus at headcrashing.eu
Sat Mar 25 17:58:39 UTC 2023
I like to propose a small addition to ImageReader and ImageWrite, as it
makes using them a bit simpler and safer: ImageReader and ImageWriter should
implement the Closable interface
(https://bugs.openjdk.org/browse/JDK-8302281).
The reason for this proposal is that I noticed that people tend to not
dispose these instances using dispose(), because they simply did not
understand that they have to. People these days are used to just try out
try-with-resources and if the IDE complains that this is not supported, then
they (falsely and carelessly) assume that there is no need to dispose these
instances. Only few people actively check the Javadocs if there is any other
method besides close(), like in this case: dispose(). For those people it
would be convenient and safe if we implement Closable. Also, such a change
would allow to write safe code little a bit simpler. The change is backwards
compatible and does not imply big risk or effort, and I do not see a
relevant reason why we should abstain from this addition, but maybe I am
missing something?
Hence I kindly ask for constructive comments on this idea.
I have already opened a draft on Github to outline what I have in mind:
https://github.com/openjdk/jdk/pull/12098
With kinds regards
-Markus Karg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20230325/a9ebd800/attachment.htm>
More information about the client-libs-dev
mailing list