Should Inflater & Deflater implement Closeable?
Jaikiran Pai
jai.forums2013 at gmail.com
Wed Nov 16 04:15:29 UTC 2022
There's https://bugs.openjdk.org/browse/JDK-8225763. I plan to revive
that effort some time soon, it's been on my todo list for the past few
months.
-Jaikiran
On 16/11/22 4:48 am, some-java-user-99206970363698485155 at vodafonemail.de
wrote:
> Hello,
> java.util.zip.Inflater and java.util.zip.Deflater both have an `end()` method to release native memory. However, both classes
> do not implement Closeable. This might prevent IDEs and other tooling from indicating that users should release the
> resources, and prevents usage in try-with-resources.
>
> Are the reasons for this only historical? (Inflater and Deflater seem to be older than Closeable)
> If so, would it be reasonable to adjust these classes to implement Closeable? The implementation could then delegate to
> `end()` (and omit `throws IOException`), though to satisfy the `close()` contract it might be necessary to track whether the
> method has already been before.
>
> I did not find anything regarding this on the bug tracker or this mailing list.
>
> Kind regards
>
More information about the core-libs-dev
mailing list