RFR: 8225763: Inflater and Deflater should implement AutoCloseable [v4]
Chen Liang
liach at openjdk.org
Thu Nov 14 05:04:43 UTC 2024
On Thu, 7 Nov 2024 14:43:41 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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.
I agree with marking these close methods as final as long as the previous corpus search did not find any user-defined close method in subclasses.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19675#discussion_r1841561300
More information about the core-libs-dev
mailing list