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

Alan Bateman alanb at openjdk.org
Tue Nov 26 17:39:40 UTC 2024


On Fri, 15 Nov 2024 11:12:06 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/zip/Inflater.java line 719:
>> 
>>> 717:      */
>>> 718:     @Override
>>> 719:     public void close() {
>> 
>> Ditto, should this be `final` to be clear about what should be overridden to perform cleanup.
>
> Done.

Inflater/Deflater date from JDK 1.1 so I think there is some risk to adding a final no-arg close method. I understand that a corpus analysis has been done, and the intention of making it final is for subclasses to know which method to override, but it doesn't take from the possibility that it might break subclasses developed years ago. If it goes ahead as reviewed, then we'll to do some outreach and be prepared to back out this change in the event  that breakage is reported before GA.

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

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


More information about the core-libs-dev mailing list