RFR: 8326096: Deprecate getTotalIn, getTotalOut methods of java.util.zip.Inflater, java.util.zip.Deflater [v9]

Eirik Bjørsnøs eirbjo at openjdk.org
Mon Feb 26 20:46:01 UTC 2024


> Please review this PR which proposes that we officially deprecate the following four methods in the `java.util.zip` package:
> 
> * `Inflater.getTotalIn()`
> * `Inflater.getTotalOut()`
> * `Deflater.getTotalIn()`
> * `Deflater.getTotalOut()`
> 
> Since these legacy methods return `int`, they cannot safely return the number of bytes processed without the risk of losing information  about the magnitude or even sign of the returned value.
> 
> The corresponding methods `getBytesRead()` and `getBytesWritten()` methods introduced in Java 5 return `long`, and should be used instead when obtaining this information. 
> 
> Unrelated to the deprecation itself, the documentation currently does not specify what these methods are expected to return when the number of processed bytes is higher than `Integer.MAX_VALUE`. This PR aims to clarify this in the API specification.
> 
> Initally, this PR handles only `Inflater.getTotalIn()`. The other three methods will be updated once the wordsmithing for this method stabilizes.

Eirik Bjørsnøs 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 12 additional commits since the last revision:

 - Use "value" instead of "number of compressed bytes input so far"
 - Merge branch 'master' into deprecate-total-in-out
 - Reduce new method description text to one sentence
 - To align with the Java Language Specification, use "all but the 32 lowest order bits"
 - Use "highest order bits" instead of "highest bits"
 - Remove empty line
 - Add back a note to specify the long-standing behavior of discarding the highest 32 bits of the return value
 - Use "greater than" instead of "larger than"
 - Leave first sentence as-is. Simplify the deprecation notice.
 - Add since="23" to @Deprecated
 - ... and 2 more: https://git.openjdk.org/jdk/compare/ff8c99ba...8d80c776

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17919/files
  - new: https://git.openjdk.org/jdk/pull/17919/files/7e4d6e4d..8d80c776

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

  Stats: 42811 lines in 1253 files changed: 20711 ins; 14092 del; 8008 mod
  Patch: https://git.openjdk.org/jdk/pull/17919.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17919/head:pull/17919

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


More information about the core-libs-dev mailing list