Inputs on patch for JDK-8225763? Inflater and Deflater should implement AutoCloseable
Jaikiran Pai
jai.forums2013 at gmail.com
Sat Jun 29 11:16:23 UTC 2019
On 29/06/19 4:31 PM, Jaikiran Pai wrote:
> Hello Stuart,
>
> Thank you for the detailed response. Comments inline.
>
> On 28/06/19 2:48 AM, Stuart Marks wrote:
>> On 6/26/19 9:28 PM, Jaikiran Pai wrote:
>>> I am looking to contribute a patch for the enhancement noted in
>>> https://bugs.openjdk.java.net/browse/JDK-8225763. The change itself
>>> looks relatively straightforward to me and here's what I plan to do:
>>>
>>> 1. Have both java.util.zip.Inflater and java.util.zip.Deflater start
>>> implementing the AutoCloseable interface
>>>
>>> 2. Have the close() method call the end() method
>>>
>>> 3. Add javadoc to the close() implementation to mention that the end()
>>> method gets called
>>>
>>> 4. Add test(s) to verify that the close indeed actually "ends" the
>>> inflater/deflater
>>>
>>> 5. This is more of a question - do we have to update the class level
>>> javadoc of both these classes to make a mention that these classes have
>>> started implementing the AutoCloseable starting version 14 (or whichever
>>> version this change makes into) of Java?
>>>
>>> Any other inputs/suggestions on what else might be needed in this
>>> change?
>> Hi Jaikiran,
>>
>> Thanks for picking this up. There are some small wrinkles with this,
>> but I hope nothing that will prevent it from happening.
>>
>>
>> 2) Alan already mentioned this, but we need to consider the issue of
>> idempotent close() or end() carefully. It's not strictly required, but
>> it would be nice. I had taken a quick look at end() and I *thought* it
>> was idempotent already, but a more careful analysis needs to be done.
> I did some checks in the current JDK code. From what I see, the Inflater
> and Deflater do not have any subclasses within the JDK itself.
To be clear - I couldn't find any subclasses in the main source code of
JDK. There are a couple of subclasses in the tests
(ConstructInflaterOutput.java and ConstructDeflaterInput.java), but
those don't do much outside of the context of testing.
-Jaikiran
More information about the core-libs-dev
mailing list