RFR JDK-8185582, Update Zip implementation to use Cleaner, not finalizers
mandy chung
mandy.chung at oracle.com
Fri Sep 29 20:50:59 UTC 2017
On 9/29/17 1:49 PM, Xueming Shen wrote:
> On 9/29/17, 1:18 PM, Peter Levart wrote:
>> Hi Sherman,
>>
>> I looked into ZipFile as promised.
>>
>> One thing I noticed is that FinalizeZipFile.java test fails compilation:
>>
>> test/jdk/java/util/zip/ZipFile/FinalizeZipFile.java:49: error: unreported exception Throwable; must be caught or declared to be thrown
>> super.finalize();
>> ^
>> (the overridden finalize() in InstrumentedZipFile should now declare
>> throws Throwable, since it overrides Object.finalize() and not
>> ZipFile.finalize() which is gone).
>>
>>
> Yes, it's the expected source incompatibility issue specified in the
> CSR request.
> I think I had it changed somewhere but obviously it's not in the
> webrev. Thanks
> for catching it. Yes, the test needs to update to be catch the throwable.
>
I would suggest to update InstrumentedZipFile to migrate away from the
finalizer. I can override the close method instead of the finalize
method. It can test explicitly calling close (that's what the test is
currently doing) and try-with-resource.
Mandy
More information about the core-libs-dev
mailing list