RFR: 8225763: Inflater and Deflater should implement AutoCloseable [v2]

Jaikiran Pai jpai at openjdk.org
Thu Jun 13 14:12:16 UTC 2024


On Wed, 12 Jun 2024 21:07:25 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   convert the tests to junit
>
> src/java.base/share/classes/java/util/zip/Deflater.java line 904:
> 
>> 902:     public void close() {
>> 903:         synchronized (zsRef) {
>> 904:             // check if already closed
> 
> Should we comment `// in case subclasses override the closed check in end()` instead? Otherwise the duplicate comments and checks are confusing.

Hello Chen, we want the close() to be idempotent irrespective of whether or not end() is overridden. That check in close() and the code comment on that line is to indicate that. If the comment is adding to confusion, I can remove it - I don't think it's a must to have it to understand the check.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19675#discussion_r1638288513


More information about the core-libs-dev mailing list