Integrated: 8066583: DeflaterInput/OutputStream and InflaterInput/OutputStream should explain responsibility for freeing resources
Jaikiran Pai
jpai at openjdk.org
Tue Apr 8 06:10:31 UTC 2025
On Sun, 16 Feb 2025 11:44:23 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
> Can I please get a review of this doc-only change which proposes to improve the API documentation of `DeflaterInputStream`, `DeflaterOutputStream`, `InflaterInputStream` and `InflaterOutputStream` classes?
>
> As noted in https://bugs.openjdk.org/browse/JDK-8066583 some of the constructors of these classes allow callers to pass a `Deflater`/`Inflater` instance. The implementation of these classes do not close the given `Deflater`/`Inflater` when the corresponding instance of the class itself is closed. This isn't documented and can lead to situations where callers aren't aware that they are responsible for closing the given `Deflater`/`Inflater` instance. That can then lead to resource leaks of resources held by the `Deflater`/`Inflater`.
>
> The commit in this PR updates the relevant constructors of these classes to add an `@implSpec` explaining the responsibility of closing the given `Inflater`/`Deflater`. I chose the `@implSpec` since each of these classes whose documentation is being updated are `public` and can be sub-classed and the `close()` method overridden. The text being added merely specifies the implementation of these classes and not the sub-classes.
>
> I'll draft a CSR once we agree on the proposed text.
This pull request has now been integrated.
Changeset: 9844c1c5
Author: Jaikiran Pai <jpai at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/9844c1c52b9b7b6959d4e5cc626495c83f4aa9d4
Stats: 344 lines in 6 files changed: 328 ins; 0 del; 16 mod
8066583: DeflaterInput/OutputStream and InflaterInput/OutputStream should explain responsibility for freeing resources
Reviewed-by: liach, alanb, lancea
-------------
PR: https://git.openjdk.org/jdk/pull/23655
More information about the core-libs-dev
mailing list