RFR 9: 8165641 : Deprecate Object.finalize

Stuart Marks stuart.marks at oracle.com
Fri Mar 31 17:29:37 UTC 2017

On 3/31/17 6:55 AM, Roger Riggs wrote:
> The webrev for deprecating finalize has been updated:
>  - to improve the advice existing JDK subclasses overriding finalize provides in
> @deprecated javadoc,
>  - to expand Object.finalize() javadoc to reinforce the correct use of
> super.finalize() by subclasses,
>  - and to remove redundant @SuppressWarnings annotations.
> Please review and comment.
> Webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-finalize-deprecate-8165641/
> Issue:
>    https://bugs.openjdk.java.net/browse/JDK-8165641

Hi Roger,

The main text in Object.finalize(), and the text for each of the occurrences of 
an overriding finalize() method, look good.

I don't think j.l.Enum.finalize() needs to be deprecated. The main point of 
deprecating finalize() is to inform subclassers. But Enum.finalize() can't be 
overriden. I suppose somebody could *call* it from an enum, and deprecation 
would serve to generate a warning, but this is pretty obscure.

I'd suggest replacing the deprecation of Enum.finalize() with @SuppressWarnings.


More information about the core-libs-dev mailing list