close 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
diff --git a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java
index f6bdb1f3b5f..634ca1ed481 100644
--- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java
@@ -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 @@ class FileOutputStream extends OutputStream
* close 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) {
diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
index a6817746cdc..6bcd5520812 100644
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -2348,6 +2348,7 @@ public abstract class ClassLoader {
this.isBuiltin = isBuiltin;
}
+ @SuppressWarnings("deprecation")
protected void finalize() {
synchronized (loadedLibraryNames) {
if (fromClass.getClassLoader() != null && loaded) {
diff --git a/jdk/src/java.base/share/classes/java/lang/Enum.java b/jdk/src/java.base/share/classes/java/lang/Enum.java
index 9a98f30bbbd..ac912f5ca65 100644
--- a/jdk/src/java.base/share/classes/java/lang/Enum.java
+++ b/jdk/src/java.base/share/classes/java/lang/Enum.java
@@ -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 @@ public abstract class Enum+ * 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, + *
{@code @Override
+ * protected void finalize() throws Throwable {
+ * try {
+ * ... // cleanup subclass state
+ * } finally {
+ * super.finalize();
+ * }
+ * }
+ * }
+ *
+ * @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 { }
}
diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java
index 661c0f5a34c..0ad2031eccb 100644
--- a/jdk/src/java.base/share/classes/java/lang/System.java
+++ b/jdk/src/java.base/share/classes/java/lang/System.java
@@ -2097,6 +2097,7 @@ public final class System {
public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
return new Thread(target, acc);
}
+ @SuppressWarnings("deprecation")
public void invokeFinalize(Object o) throws Throwable {
o.finalize();
}
diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
index 4945713e228..d4414560fe6 100644
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
@@ -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 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
return (fd == null) ? true : false;
}
+ @SuppressWarnings("deprecation")
protected void finalize() {
close();
}
diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
index 465ec01cc37..e66bbdc61aa 100644
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
@@ -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 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
/**
* Cleans up if the user forgets to close it.
*/
+ @SuppressWarnings("deprecation")
protected void finalize() throws IOException {
close();
}
diff --git a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java
index 2f54d344659..04ee3378eaa 100644
--- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java
+++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java
@@ -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 @@ class SocketInputStream extends FileInputStream
/**
* Overrides finalize, the fd is closed by the Socket.
*/
+ @SuppressWarnings("deprecation")
protected void finalize() {}
/**
diff --git a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java
index 9cbe056066f..0ba877bf56e 100644
--- a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java
+++ b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java
@@ -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 @@ class SocketOutputStream extends FileOutputStream
/**
* Overrides finalize, the fd is closed by the Socket.
*/
+ @SuppressWarnings("deprecation")
protected void finalize() {}
/**
diff --git a/jdk/src/java.base/share/classes/java/util/Timer.java b/jdk/src/java.base/share/classes/java/util/Timer.java
index 770d9f9df8b..7c47d0c7135 100644
--- a/jdk/src/java.base/share/classes/java/util/Timer.java
+++ b/jdk/src/java.base/share/classes/java/util/Timer.java
@@ -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 @@ public class Timer {
* finalizer forgetting to call it.
*/
private final Object threadReaper = new Object() {
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
synchronized(queue) {
thread.newTasksMayBeScheduled = false;
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java b/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java
index a31e3a1ebac..00fdf25772c 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java
@@ -713,6 +713,7 @@ public class Executors {
FinalizableDelegatedExecutorService(ExecutorService executor) {
super(executor);
}
+ @SuppressWarnings("deprecation")
protected void finalize() {
super.shutdown();
}
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java
index 0016bfffe87..ceb9bf2022f 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java
@@ -1490,7 +1490,17 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
/**
* 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();
}
diff --git a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java
index bf70f4dd8a1..6eb5065040e 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java
@@ -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 @@ class Deflater {
/**
* 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();
}
diff --git a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java
index 94c05e1d315..2aab545f2a1 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java
@@ -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 @@ class Inflater {
/**
* 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();
}
diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java
index ecd002bc340..83ce2441eeb 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java
@@ -420,6 +420,7 @@ class ZipFile implements ZipConstants, Closeable {
Integer.MAX_VALUE : (int) avail);
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
close();
}
@@ -641,9 +642,18 @@ class ZipFile implements ZipConstants, Closeable {
* 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 @@ class ZipFile implements ZipConstants, Closeable {
}
}
+ @SuppressWarnings("deprecation")
protected void finalize() {
close();
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java
index 49285b31dfb..d544e4c0deb 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java
@@ -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 @@ class JrtFileSystem extends FileSystem {
}
@Override
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
cleanup();
diff --git a/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java b/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java
index 29b998a5e70..08ff179457a 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java
@@ -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 @@ public class MeteredStream extends FilterInputStream {
return super.markSupported();
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
close();
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java
index b6ff7b417ac..2b5e5115cf3 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java
@@ -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 @@ public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnecti
* Called by layered delegator's finalize() method to handle closing
* the underlying object.
*/
+ @SuppressWarnings("deprecation")
protected void dispose() throws Throwable {
super.finalize();
}
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
index 1b2a584a79b..792af78675c 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
@@ -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 @@ public class HttpsURLConnectionImpl
* sun.net.www.protocol.http.HttpURLConnection's finalize()
* would have to be made public.
*/
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
delegate.dispose();
}
diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
index 7f63ec88264..c4d508070d4 100644
--- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -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 @@ class DatagramChannelImpl
}
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws IOException {
// fd is null if constructor threw exception
if (fd != null)
diff --git a/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java b/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java
index ef7a1f43ffb..bffa1f5b283 100644
--- a/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java
+++ b/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java
@@ -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 @@ final class KeyProtector {
* 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);
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java
index a09932d94e5..51560f5872d 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java
@@ -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 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* the penalty of prematurly killing SSL sessions.
*/
@Override
+ @SuppressWarnings("deprecation")
protected final void finalize() throws Throwable {
try {
close();
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java b/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java
index 3ef37b798a1..0bb89fbc3ca 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java
@@ -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 @@ public abstract class SunJSSE extends java.security.Provider {
}
@Override
+ @SuppressWarnings("deprecation")
protected final void finalize() throws Throwable {
// empty
super.finalize();
diff --git a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java
index 115002b5825..e3579449b75 100644
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java
+++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java
@@ -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 @@ public final class JRSUIControl {
changes.putAll(other.changes);
}
+ @SuppressWarnings("deprecation")
protected synchronized void finalize() throws Throwable {
if (cfDictionaryPtr == 0) return;
disposeCFDictionary(cfDictionaryPtr);
diff --git a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java
index f0db13f9567..ce5ed8b141e 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java
@@ -124,6 +124,7 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
}
@Override
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
super.finalize();
diff --git a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java
index c8c3f5b1fae..15abdda711d 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java
@@ -250,6 +250,7 @@ public final class CFont extends PhysicalFont implements FontSubstitution {
return compFont;
}
+ @SuppressWarnings("deprecation")
protected synchronized void finalize() {
if (nativeFontPtr != 0) {
disposeNativeFont(nativeFontPtr);
diff --git a/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java b/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java
index ed3838886c9..7eba9678020 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java
@@ -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 @@ public final class CStrike extends PhysicalStrike {
return nativeStrikePtr;
}
+ @SuppressWarnings("deprecation")
protected synchronized void finalize() throws Throwable {
if (nativeStrikePtr != 0) {
disposeNativeStrikePtr(nativeStrikePtr);
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java
index f69ad201ef8..e53f23a304b 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java
@@ -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 @@ public class CFRetainedResource {
}
@Override
+ @SuppressWarnings("deprecation")
protected final void finalize() throws Throwable {
dispose();
}
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
index 2d54d62b799..e54e1532666 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
@@ -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 @@ public final class CPrinterJob extends RasterPrinterJob {
// The following methods are CPrinterJob specific.
@Override
+ @SuppressWarnings("deprecation")
protected void finalize() {
synchronized (fNSPrintInfoLock) {
if (fNSPrintInfo != -1) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java
index cdcb68dd90d..8ddffc522f1 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java
@@ -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 @@ public final class SubImageInputStream extends ImageInputStreamImpl {
streamPos = pos;
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
// Empty finalizer (for improved performance; no need to call
// super.finalize() in this case)
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
index f1660f8a159..3fbc55c82b9 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
@@ -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 @@ final class ChunkStream extends ImageOutputStreamImpl {
}
@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 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
}
@Override
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
// Empty finalizer (for improved performance; no need to call
// super.finalize() in this case)
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java
index 46185618913..2adc479411c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java
@@ -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 @@ public abstract class TIFFBaseJPEGCompressor extends TIFFCompressor {
return compDataLength;
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
super.finalize();
if(JPEGWriter != null) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java
index 966ca9575d9..384687f8344 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java
@@ -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 @@ public class TIFFJPEGDecompressor extends TIFFDecompressor {
JPEGReader.read(0, JPEGParam);
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
super.finalize();
JPEGReader.dispose();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java
index 2837754ddb2..67dd60f8a79 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java
@@ -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 @@ public class TIFFOldJPEGDecompressor extends TIFFJPEGDecompressor {
JPEGReader.read(0, JPEGParam);
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
super.finalize();
JPEGReader.dispose();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java
index 36954988f1b..be1e659ee6e 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java
@@ -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 @@ public class StreamFinalizer {
this.stream = stream;
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
stream.close();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java
index 672b76f926b..bea9f5daf24 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java
@@ -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 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
* close this device if discarded by the garbage collector.
*/
@Override
+ @SuppressWarnings("deprecation")
protected final void finalize() {
close();
}
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Graphics.java b/jdk/src/java.desktop/share/classes/java/awt/Graphics.java
index 932a89d5ade..317a93fad22 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Graphics.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Graphics.java
@@ -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 @@ public abstract class Graphics {
/**
* 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();
}
diff --git a/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java b/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java
index fcc6afebf2a..9012608584f 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java
@@ -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 @@ public abstract class PrintJob {
/**
* 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();
}
diff --git a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
index 3adc80fa59f..625664f41d0 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
@@ -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 @@ public class ICC_Profile implements Serializable {
/**
* 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);
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java
index 07e823ce6aa..2be7f7e844f 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java
@@ -1620,7 +1620,17 @@ public abstract class ColorModel implements Transparency{
* 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 @@ public abstract class ColorModel implements Transparency{
return lg16Toog16LUT;
}
-}
\ No newline at end of file
+}
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
index 3a172c142e2..81aab994178 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java
@@ -1514,7 +1514,17 @@ public class IndexColorModel extends ColorModel {
* 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 @@ public class IndexColorModel extends ColorModel {
}
return result;
}
-}
\ No newline at end of file
+}
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java
index 465f155374e..2df6e1ba03b 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java
@@ -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 @@ public class ServiceRegistry {
*
* @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 @@ class SubRegistry {
poset.clear();
}
+ @SuppressWarnings("deprecation")
public synchronized void finalize() {
clear();
}
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
index f354f7a113a..e5974900161 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
@@ -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 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl {
/**
* {@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
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java
index b7129085317..7ecc28767a0 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java
@@ -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 @@ public class FileImageInputStream extends ImageInputStreamImpl {
/**
* {@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
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java
index c76d09f4b71..e75c40396d8 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java
@@ -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 @@ public class FileImageOutputStream extends ImageOutputStreamImpl {
/**
* {@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
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
index 3d17e278e99..c7cdc47cdaf 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
@@ -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 @@ public abstract class ImageInputStreamImpl implements ImageInputStream {
*
* @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 {
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java
index 87774c1d94f..4fcb0f40b81 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java
@@ -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 @@ public class MemoryCacheImageInputStream extends ImageInputStreamImpl {
/**
* {@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
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java
index d6b897fd93f..4f26f54d8b8 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java
@@ -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 @@ public final class StringContent implements AbstractDocument.Content, Serializab
return rec.offset;
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
// schedule the record to be removed later
// on another thread.
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java b/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java
index 8d37a2d6a1d..ac42b424152 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java
@@ -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 @@ public class BufImgSurfaceData extends SurfaceData {
this.pData = pData;
}
+ @SuppressWarnings("deprecation")
public void finalize() {
if (pData != 0L) {
BufImgSurfaceData.freeNativeICMData(pData);
diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java
index 4c0abc9eec8..d2ae86ef3b4 100644
--- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java
@@ -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 @@ public final class SunGraphics2D
* 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
}
diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java
index 69bba24c2a6..cf8193f0c42 100644
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java
@@ -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 class RegionClipSpanIterator implements SpanIterator {
*/
//public native void dispose();
+ @SuppressWarnings("deprecation")
protected void finalize() {
//dispose();
}
diff --git a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java
index b76321d84a3..c273ca1d071 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java
@@ -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 @@ public class PeekGraphics extends Graphics2D
/**
* Empty finalizer as no clean up needed here.
*/
+ @SuppressWarnings("deprecation")
public void finalize() {
}
diff --git a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java
index b62c4eb1298..9d9b2009af3 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java
@@ -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 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
* Ends this print job once it is no longer referenced.
* @see #end
*/
+ @SuppressWarnings("deprecation")
public void finalize() {
end();
}
diff --git a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java
index eefb49ee75a..5d50ab8ba9d 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java
@@ -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 @@ public class ProxyGraphics extends Graphics {
/**
* Empty finalizer as no clean up needed here.
*/
+ @SuppressWarnings("deprecation")
public void finalize() {
}
diff --git a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java
index 6ded8e98eab..2fc626721e2 100644
--- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java
+++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java
@@ -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 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics {
/**
* Empty finalizer as no clean up needed here.
*/
+ @SuppressWarnings("deprecation")
public void finalize() {
}
diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
index 0ac2a16243a..2e570129f84 100644
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java
@@ -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 @@ public abstract class X11InputMethod extends InputMethodAdapter {
}
}
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
dispose();
super.finalize();
diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java
index 4bd8f7b5e98..1d3a176388c 100644
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java
@@ -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 @@ final class WInputMethod extends InputMethodAdapter
}
@Override
+ @SuppressWarnings("deprecation")
protected void finalize() throws Throwable
{
// Release the resources used by the native input context.
diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
index 8bef0da95ca..31b9c5c87d0 100644
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
@@ -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 @@ abstract class AbstractLdapNamingEnumeration