changeset 16948:9289f04ddb54

8165641: Deprecate Object.finalize Reviewed-by: mchung, smarks
author rriggs
date Wed, 05 Apr 2017 09:57:32 -0400
parents a49fb788ac68
children cda91600a4bd
files src/java.base/share/classes/com/sun/crypto/provider/DESKey.java src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java src/java.base/share/classes/java/io/FileInputStream.java src/java.base/share/classes/java/io/FileOutputStream.java src/java.base/share/classes/java/lang/ClassLoader.java src/java.base/share/classes/java/lang/Enum.java src/java.base/share/classes/java/lang/Object.java src/java.base/share/classes/java/lang/System.java src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java src/java.base/share/classes/java/net/SocketInputStream.java src/java.base/share/classes/java/net/SocketOutputStream.java src/java.base/share/classes/java/util/Timer.java src/java.base/share/classes/java/util/concurrent/Executors.java src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java src/java.base/share/classes/java/util/zip/Deflater.java src/java.base/share/classes/java/util/zip/Inflater.java src/java.base/share/classes/java/util/zip/ZipFile.java src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java src/java.base/share/classes/sun/net/www/MeteredStream.java src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java src/java.base/share/classes/sun/security/provider/KeyProtector.java src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java src/java.base/share/classes/sun/security/ssl/SunJSSE.java src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java src/java.desktop/macosx/classes/sun/font/CFont.java src/java.desktop/macosx/classes/sun/font/CStrike.java src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java src/java.desktop/share/classes/java/awt/Graphics.java src/java.desktop/share/classes/java/awt/PrintJob.java src/java.desktop/share/classes/java/awt/color/ICC_Profile.java src/java.desktop/share/classes/java/awt/image/ColorModel.java src/java.desktop/share/classes/java/awt/image/IndexColorModel.java src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java src/java.desktop/share/classes/javax/swing/text/StringContent.java src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java src/java.desktop/share/classes/sun/print/PeekGraphics.java src/java.desktop/share/classes/sun/print/PrintJob2D.java src/java.desktop/share/classes/sun/print/ProxyGraphics.java src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java src/java.desktop/unix/classes/sun/awt/X11InputMethod.java src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
diffstat 82 files changed, 354 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -149,6 +149,7 @@
      * Ensures that the bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,6 +150,7 @@
      * Ensures that the bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,6 +145,7 @@
      * Ensures that the password bytes of this key are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.key != null) {
--- a/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -267,6 +267,7 @@
      * Ensures that the password bytes of this key are
      * erased when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (this.passwd != null) {
--- a/src/java.base/share/classes/java/io/FileInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/io/FileInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -413,9 +413,19 @@
      * Ensures that the <code>close</code> method of this file input stream is
      * called when there are no more references to it.
      *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
+     *
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.FileInputStream#close()
      */
+    @Deprecated(since="9")
     protected void finalize() throws IOException {
         if ((fd != null) &&  (fd != FileDescriptor.in)) {
             /* if fd is shared, the references in FileDescriptor
--- a/src/java.base/share/classes/java/io/FileOutputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/io/FileOutputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -427,9 +427,18 @@
      * <code>close</code> method of this file output stream is
      * called when there are no more references to this stream.
      *
+     * @deprecated The {@code finalize} method has been deprecated.
+     * Subclasses that override {@code finalize} in order to perform cleanup
+     * should be modified to use alternative cleanup mechanisms and
+     * to remove the overriding {@code finalize} method.
+     * When overriding the {@code finalize} method, its implementation must explicitly
+     * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     * See the specification for {@link Object#finalize()} for further
+     * information about migration options.
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.FileInputStream#close()
      */
+    @Deprecated(since="9")
     protected void finalize() throws IOException {
         if (fd != null) {
             if (fd == FileDescriptor.out || fd == FileDescriptor.err) {
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Apr 05 09:57:32 2017 -0400
@@ -2348,6 +2348,7 @@
             this.isBuiltin = isBuiltin;
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() {
             synchronized (loadedLibraryNames) {
                 if (fromClass.getClassLoader() != null && loaded) {
--- a/src/java.base/share/classes/java/lang/Enum.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/lang/Enum.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -243,6 +243,7 @@
     /**
      * enum classes cannot have finalize methods.
      */
+    @SuppressWarnings("deprecation")
     protected final void finalize() { }
 
     /**
--- a/src/java.base/share/classes/java/lang/Object.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/lang/Object.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -561,10 +561,53 @@
      * the finalization of this object to be halted, but is otherwise
      * ignored.
      *
+     * @apiNote
+     * Classes that embed non-heap resources have many options
+     * for cleanup of those resources. The class must ensure that the
+     * lifetime of each instance is longer than that of any resource it embeds.
+     * {@link java.lang.ref.Reference#reachabilityFence} can be used to ensure that
+     * objects remain reachable while resources embedded in the object are in use.
+     * <p>
+     * A subclass should avoid overriding the {@code finalize} method
+     * unless the subclass embeds non-heap resources that must be cleaned up
+     * before the instance is collected.
+     * Finalizer invocations are not automatically chained, unlike constructors.
+     * If a subclass overrides {@code finalize} it must invoke the superclass
+     * finalizer explicitly.
+     * To guard against exceptions prematurely terminating the finalize chain,
+     * the subclass should use a {@code try-finally} block to ensure
+     * {@code super.finalize()} is always invoked. For example,
+     * <pre>{@code      @Override
+     *     protected void finalize() throws Throwable {
+     *         try {
+     *             ... // cleanup subclass state
+     *         } finally {
+     *             super.finalize();
+     *         }
+     *     }
+     * }</pre>
+     *
+     * @deprecated The finalization mechanism is inherently problematic.
+     * Finalization can lead to performance issues, deadlocks, and hangs.
+     * Errors in finalizers can lead to resource leaks; there is no way to cancel
+     * finalization if it is no longer necessary; and no ordering is specified
+     * among calls to {@code finalize} methods of different objects.
+     * Furthermore, there are no guarantees regarding the timing of finalization.
+     * The {@code finalize} method might be called on an finalizable object
+     * only after an indefinite delay, if at all.
+     *
+     * Classes whose instances hold non-heap resources should provide a method
+     * to enable explicit release of those resources, and they should also
+     * implement {@link AutoCloseable} if appropriate.
+     * The {@link java.lang.ref.Cleaner} and {@link java.lang.ref.PhantomReference}
+     * provide more flexible and efficient ways to release resources when an object
+     * becomes unreachable.
+     *
      * @throws Throwable the {@code Exception} raised by this method
      * @see java.lang.ref.WeakReference
      * @see java.lang.ref.PhantomReference
      * @jls 12.6 Finalization of Class Instances
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable { }
 }
--- a/src/java.base/share/classes/java/lang/System.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/lang/System.java	Wed Apr 05 09:57:32 2017 -0400
@@ -2097,6 +2097,7 @@
             public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
                 return new Thread(target, acc);
             }
+            @SuppressWarnings("deprecation")
             public void invokeFinalize(Object o) throws Throwable {
                 o.finalize();
             }
--- a/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -275,6 +275,7 @@
         return (fd == null) ? true : false;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         close();
     }
--- a/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -646,6 +646,7 @@
     /**
      * Cleans up if the user forgets to close it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         close();
     }
--- a/src/java.base/share/classes/java/net/SocketInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/net/SocketInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -283,6 +283,7 @@
     /**
      * Overrides finalize, the fd is closed by the Socket.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() {}
 
     /**
--- a/src/java.base/share/classes/java/net/SocketOutputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/net/SocketOutputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,6 +175,7 @@
     /**
      * Overrides finalize, the fd is closed by the Socket.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() {}
 
     /**
--- a/src/java.base/share/classes/java/util/Timer.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/util/Timer.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,6 +108,7 @@
      * finalizer forgetting to call it.
      */
     private final Object threadReaper = new Object() {
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             synchronized(queue) {
                 thread.newTasksMayBeScheduled = false;
--- a/src/java.base/share/classes/java/util/concurrent/Executors.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/Executors.java	Wed Apr 05 09:57:32 2017 -0400
@@ -713,6 +713,7 @@
         FinalizableDelegatedExecutorService(ExecutorService executor) {
             super(executor);
         }
+        @SuppressWarnings("deprecation")
         protected void finalize() {
             super.shutdown();
         }
--- a/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1490,7 +1490,17 @@
     /**
      * Invokes {@code shutdown} when this executor is no longer
      * referenced and it has no threads.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() {
         shutdown();
     }
--- a/src/java.base/share/classes/java/util/zip/Deflater.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Deflater.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -551,7 +551,17 @@
 
     /**
      * Closes the compressor when garbage is collected.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() {
         end();
     }
--- a/src/java.base/share/classes/java/util/zip/Inflater.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Inflater.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -378,7 +378,17 @@
 
     /**
      * Closes the decompressor when garbage is collected.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() {
         end();
     }
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Apr 05 09:57:32 2017 -0400
@@ -420,6 +420,7 @@
                     Integer.MAX_VALUE : (int) avail);
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             close();
         }
@@ -641,9 +642,18 @@
      * This will prevent holding up system resources for an undetermined
      * length of time.
      *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      * @throws IOException if an I/O error has occurred
      * @see    java.util.zip.ZipFile#close()
      */
+    @Deprecated(since="9")
     protected void finalize() throws IOException {
         close();
     }
@@ -813,6 +823,7 @@
             }
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() {
             close();
         }
--- a/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             cleanup();
--- a/src/java.base/share/classes/sun/net/www/MeteredStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/net/www/MeteredStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,6 +203,7 @@
         return super.markSupported();
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             close();
--- a/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,7 @@
      * Called by layered delegator's finalize() method to handle closing
      * the underlying object.
      */
+    @SuppressWarnings("deprecation")
     protected void dispose() throws Throwable {
         super.finalize();
     }
--- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -478,6 +478,7 @@
      * sun.net.www.protocol.http.HttpURLConnection's finalize()
      * would have to be made public.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         delegate.dispose();
     }
--- a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1034,6 +1034,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         // fd is null if constructor threw exception
         if (fd != null)
--- a/src/java.base/share/classes/sun/security/provider/KeyProtector.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/security/provider/KeyProtector.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -147,6 +147,7 @@
      * Ensures that the password bytes of this key protector are
      * set to zero when there are no more references to it.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         if (passwdBytes != null) {
             Arrays.fill(passwdBytes, (byte)0x00);
--- a/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -265,6 +265,7 @@
      * the penalty of prematurly killing SSL sessions.
      */
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() throws Throwable {
         try {
             close();
--- a/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -247,6 +247,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() throws Throwable {
         // empty
         super.finalize();
--- a/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,6 +114,7 @@
         changes.putAll(other.changes);
     }
 
+    @SuppressWarnings("deprecation")
     protected synchronized void finalize() throws Throwable {
         if (cfDictionaryPtr == 0) return;
         disposeCFDictionary(cfDictionaryPtr);
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java	Wed Apr 05 09:57:32 2017 -0400
@@ -124,6 +124,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             super.finalize();
--- a/src/java.desktop/macosx/classes/sun/font/CFont.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/macosx/classes/sun/font/CFont.java	Wed Apr 05 09:57:32 2017 -0400
@@ -250,6 +250,7 @@
         return compFont;
     }
 
+    @SuppressWarnings("deprecation")
     protected synchronized void finalize() {
         if (nativeFontPtr != 0) {
             disposeNativeFont(nativeFontPtr);
--- a/src/java.desktop/macosx/classes/sun/font/CStrike.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/macosx/classes/sun/font/CStrike.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,6 +127,7 @@
         return nativeStrikePtr;
     }
 
+    @SuppressWarnings("deprecation")
     protected synchronized void finalize() throws Throwable {
         if (nativeStrikePtr != 0) {
             disposeNativeStrikePtr(nativeStrikePtr);
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,6 +135,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() throws Throwable {
         dispose();
     }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -556,6 +556,7 @@
     // The following methods are CPrinterJob specific.
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         synchronized (fNSPrintInfoLock) {
             if (fNSPrintInfo != -1) {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,6 +72,7 @@
         streamPos = pos;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         // Empty finalizer (for improved performance; no need to call
         // super.finalize() in this case)
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,6 +143,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         // Empty finalizer (for improved performance; no need to call
         // super.finalize() in this case)
@@ -279,6 +280,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         // Empty finalizer (for improved performance; no need to call
         // super.finalize() in this case)
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -435,6 +435,7 @@
         return compDataLength;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         super.finalize();
         if(JPEGWriter != null) {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,7 @@
         JPEGReader.read(0, JPEGParam);
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         super.finalize();
         JPEGReader.dispose();
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -610,6 +610,7 @@
         JPEGReader.read(0, JPEGParam);
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         super.finalize();
         JPEGReader.dispose();
--- a/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,6 +60,7 @@
         this.stream = stream;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             stream.close();
--- a/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -444,6 +444,7 @@
      * close this device if discarded by the garbage collector.
      */
     @Override
+    @SuppressWarnings("deprecation")
     protected final void finalize() {
         close();
     }
--- a/src/java.desktop/share/classes/java/awt/Graphics.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/java/awt/Graphics.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1159,8 +1159,18 @@
 
     /**
      * Disposes of this graphics context once it is no longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      * @see #dispose
      */
+    @Deprecated(since="9")
     public void finalize() {
         dispose();
     }
--- a/src/java.desktop/share/classes/java/awt/PrintJob.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/java/awt/PrintJob.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,8 +79,18 @@
 
     /**
      * Ends this print job once it is no longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      * @see #end
      */
+    @Deprecated(since="9")
     public void finalize() {
         end();
     }
--- a/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -751,7 +751,17 @@
 
     /**
      * Frees the resources associated with an ICC_Profile object.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize () {
         if (cmmProfile != null) {
             CMSManager.getModule().freeProfile(cmmProfile);
--- a/src/java.desktop/share/classes/java/awt/image/ColorModel.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/java/awt/image/ColorModel.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1620,7 +1620,17 @@
      * Disposes of system resources associated with this
      * {@code ColorModel} once this {@code ColorModel} is no
      * longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     public void finalize() {
     }
 
@@ -1952,4 +1962,4 @@
         return lg16Toog16LUT;
     }
 
-}
\ No newline at end of file
+}
--- a/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1514,7 +1514,17 @@
      * Disposes of system resources associated with this
      * {@code ColorModel} once this {@code ColorModel} is no
      * longer referenced.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     public void finalize() {
     }
 
@@ -1630,4 +1640,4 @@
         }
         return result;
     }
-}
\ No newline at end of file
+}
--- a/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -706,7 +706,17 @@
      *
      * @exception Throwable if an error occurs during superclass
      * finalization.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     public void finalize() throws Throwable {
         deregisterAll();
         super.finalize();
@@ -846,6 +856,7 @@
         poset.clear();
     }
 
+    @SuppressWarnings("deprecation")
     public synchronized void finalize() {
         clear();
     }
--- a/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -260,7 +260,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -163,7 +163,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -867,7 +867,17 @@
      *
      * @exception Throwable if an error occurs during superclass
      * finalization.
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         if (!isClosed) {
             try {
--- a/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -178,7 +178,17 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @deprecated The {@code finalize} method has been deprecated.
+     *     Subclasses that override {@code finalize} in order to perform cleanup
+     *     should be modified to use alternative cleanup mechanisms and
+     *     to remove the overriding {@code finalize} method.
+     *     When overriding the {@code finalize} method, its implementation must explicitly
+     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
+     *     See the specification for {@link Object#finalize()} for further
+     *     information about migration options.
      */
+    @Deprecated(since="9")
     protected void finalize() throws Throwable {
         // Empty finalizer: for performance reasons we instead use the
         // Disposer mechanism for ensuring that the underlying
--- a/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -351,6 +351,7 @@
             return rec.offset;
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             // schedule the record to be removed later
             // on another thread.
--- a/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -472,6 +472,7 @@
             this.pData = pData;
         }
 
+        @SuppressWarnings("deprecation")
         public void finalize() {
             if (pData != 0L) {
                 BufImgSurfaceData.freeNativeICMData(pData);
--- a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3633,6 +3633,7 @@
      * enough to know that if our override is empty then it should not
      * mark us as finalizeable.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
         // DO NOT REMOVE THIS METHOD
     }
--- a/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -383,6 +383,7 @@
      */
     //public native void dispose();
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         //dispose();
     }
--- a/src/java.desktop/share/classes/sun/print/PeekGraphics.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/print/PeekGraphics.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1336,6 +1336,7 @@
     /**
      * Empty finalizer as no clean up needed here.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
     }
 
--- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -942,6 +942,7 @@
      * Ends this print job once it is no longer referenced.
      * @see #end
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
         end();
     }
--- a/src/java.desktop/share/classes/sun/print/ProxyGraphics.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/print/ProxyGraphics.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1099,6 +1099,7 @@
     /**
      * Empty finalizer as no clean up needed here.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
     }
 
--- a/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1264,6 +1264,7 @@
     /**
      * Empty finalizer as no clean up needed here.
      */
+    @SuppressWarnings("deprecation")
     public void finalize() {
     }
 
--- a/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -181,6 +181,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
         super.finalize();
--- a/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,6 +132,7 @@
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable
     {
         // Release the resources used by the native input context.
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -382,6 +382,7 @@
         listArg = ne.listArg;
     }
 
+    @SuppressWarnings("deprecation")
     protected final void finalize() {
         cleanup();
     }
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -474,6 +474,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         if (debug > 0) System.err.println("LdapClient: finalize " + this);
         forceClose(pooled);
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2609,6 +2609,7 @@
 
    // ----------------- Connection  ---------------------
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         try {
             close();
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,6 +129,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         clearPassword();
     }
--- a/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,6 +128,7 @@
     /**
      * Closes the stream when garbage is collected.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         close();
     }
--- a/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -440,6 +440,7 @@
     /**
      * Shut down connection upon finalization.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable
     {
         super.finalize();
--- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -130,6 +130,7 @@
         return "N/A";
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -289,6 +289,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -618,6 +618,7 @@
         return isInitiator;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,6 +136,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         clearPassword();
     }
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -199,6 +199,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         clearPassword();
     }
--- a/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -274,6 +274,7 @@
             + ", protocol " + getProtocol() + ", state " + state;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             if (state == State.OK) {
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -241,6 +241,7 @@
             pc.setPassword(password);  // this clones the password if not null
         }
 
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable {
             if (password != null) {
                 Arrays.fill(password, ' ');
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -1531,6 +1531,7 @@
      *
      * @exception Throwable If finalization fails.
      */
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         disconnect();
     }
--- a/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
         /**
          * Finalization method
          */
+        @SuppressWarnings("deprecation")
         protected void finalize() throws Throwable
         {
             try {
--- a/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java	Wed Apr 05 09:57:32 2017 -0400
@@ -306,6 +306,7 @@
      * Shuts down the ConsoleReader if the JVM attempts to clean it up.
      */
     @Override
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         try {
             shutdown();
--- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -142,6 +142,7 @@
         resps = Collections.synchronizedMap(new HashMap<Integer, byte[]>());
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         close();
     }
--- a/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,6 +119,7 @@
         reference = ctx.reference;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         close();
     }
@@ -593,6 +594,7 @@
         nextName = 0;
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() {
         ctx.close();
     }
@@ -633,6 +635,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void close () {
         finalize();
     }
--- a/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Wed Apr 05 09:57:32 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,6 +158,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws Throwable {
         dispose();
     }
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Tue Apr 04 19:58:24 2017 -0700
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Wed Apr 05 09:57:32 2017 -0400
@@ -936,6 +936,7 @@
         return zc.toString(name);
     }
 
+    @SuppressWarnings("deprecation")
     protected void finalize() throws IOException {
         close();
     }