RFR: 8066583: DeflaterInput/OutputStream and InflaterInput/OutputStream should explain responsibility for freeing resources [v8]

Jaikiran Pai jpai at openjdk.org
Thu Apr 3 11:40:23 UTC 2025


> 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.

Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 16 additional commits since the last revision:

 - additional inputs
 - merge latest from master branch
 - Alan's input - replace "@apiNote" in favour of formal spec
 - merge latest from master branch
 - Lance's inputs
 - merge latest from master branch
 - merge latest from master branch
 - merge latest from master branch
 - additional updates to the doc
 - merge latest from master branch
 - ... and 6 more: https://git.openjdk.org/jdk/compare/803443c7...cfeef86d

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/23655/files
  - new: https://git.openjdk.org/jdk/pull/23655/files/f2d08bad..cfeef86d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23655&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23655&range=06-07

  Stats: 5880 lines in 369 files changed: 3265 ins; 2002 del; 613 mod
  Patch: https://git.openjdk.org/jdk/pull/23655.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23655/head:pull/23655

PR: https://git.openjdk.org/jdk/pull/23655


More information about the core-libs-dev mailing list