RFR: 8326096: Deprecate getTotalIn, getTotalOut methods of java.util.zip.Inflater, java.util.zip.Deflater [v5]
Eirik Bjørsnøs
eirbjo at openjdk.org
Thu Feb 22 14:04:07 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 incrementally with two additional commits since the last revision:
- Remove empty line
- Add back a note to specify the long-standing behavior of discarding the highest 32 bits of the return value
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/17919/files
- new: https://git.openjdk.org/jdk/pull/17919/files/86695619..44323ab0
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=17919&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=17919&range=03-04
Stats: 10 lines in 1 file changed: 10 ins; 0 del; 0 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