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

Jaikiran Pai jpai at openjdk.org
Thu Nov 7 14:46:50 UTC 2024


On Thu, 7 Nov 2024 14:28:34 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> 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 nine additional commits since the last revision:
>> 
>>  - update tests to match the new specification
>>  - Stuart's review - update the close() and end() expectations
>>  - Stuart's review - improve class level javadoc
>>  - merge latest from master branch
>>  - merge latest from master branch
>>  - Chen's suggestion - improve code comment
>>  - convert the tests to junit
>>  - fix whitespace
>>  - 8225763: Inflater and Deflater should implement AutoCloseable
>
> src/java.base/share/classes/java/util/zip/Deflater.java line 902:
> 
>> 900:      */
>> 901:     @Override
>> 902:     public void close() {
> 
> Can/should this method be final?  The real/original cleanup method is `end` and if both `close()` and `end()` are overriddable, there may be some confusion about which to implement.

Hello Roger, I think that's a good idea. At least until there is a real reason for `close()` to be overridden by subclasses. I went back and checked the mailing list discussions (linked in this PR description) and I don't think marking `close()` as `final` has been suggested or rejected before. I will give others a chance to provide their inputs before I do this change.

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

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


More information about the core-libs-dev mailing list