This commit is contained in:
Lana Steuck 2017-04-06 18:00:10 +00:00
commit 501103c21e
138 changed files with 3093 additions and 287 deletions

View File

@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2017a
tzdata2017b

View File

@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte
# See Africa/Johannesburg.
# Liberia
# From Paul Eggert (2006-03-22):
# In 1972 Liberia was the last country to switch
# from a UTC offset that was not a multiple of 15 or 20 minutes.
# Howse reports that it was in honor of their president's birthday.
# Shank & Pottenger report the date as May 1, whereas Howse reports Jan;
# go with Shanks & Pottenger.
# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and
# Whitman each report -0:44:30; go with the more precise figure.
#
# From Paul Eggert (2017-03-02):
#
# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
#
# In 1972 Liberia was the last country to switch from a UTC offset
# that was not a multiple of 15 or 20 minutes. The 1972 change was on
# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
# Presidential Papers: First year of the administration of
# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
# Monrovia: Executive Mansion.
#
# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
# abbreviation "-004430" would be one byte over the POSIX limit.
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Monrovia -0:43:08 - LMT 1882
-0:43:08 - MMT 1919 Mar # Monrovia Mean Time
-0:44:30 - -004430 1972 May
-0:44:30 - MMT 1972 Jan 7 # approximately MMT
0:00 - GMT
###############################################################################

View File

@ -32,8 +32,8 @@
# All text uses UTF-8 encoding. The columns of the table are as follows:
#
# 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166
# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
# ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1
# http://isotc.iso.org/livelink/livelink/Open/16944257
# 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.

View File

@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5
# http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
# http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
# From Steffen Thorsen (2017-03-12):
# We have received 4 mails from different people telling that Haiti
# has started DST again today, and this source seems to confirm that,
# I have not been able to find a more authoritative source:
# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Haiti 1983 only - May 8 0:00 1:00 D
Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D
@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D
Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S
Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S
Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Port-au-Prince -4:49:20 - LMT 1890
-4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT

View File

@ -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 @@ final class DESKey implements SecretKey {
* 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) {

View File

@ -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 @@ final class DESedeKey implements SecretKey {
* 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) {

View File

@ -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 @@ final class PBEKey implements SecretKey {
* 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) {

View File

@ -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 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
* 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) {

View File

@ -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
@ -297,14 +297,15 @@ public class BufferedReader extends Reader {
/**
* Reads a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
* followed immediately by a linefeed.
* of a line feed ('\n'), a carriage return ('\r'), a carriage return
* followed immediately by a line feed, or by reaching the end-of-file
* (EOF).
*
* @param ignoreLF If true, the next '\n' will be skipped
*
* @return A String containing the contents of the line, not including
* any line-termination characters, or null if the end of the
* stream has been reached
* stream has been reached without reading any characters
*
* @see java.io.LineNumberReader#readLine()
*
@ -375,12 +376,13 @@ public class BufferedReader extends Reader {
/**
* Reads a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
* followed immediately by a linefeed.
* of a line feed ('\n'), a carriage return ('\r'), a carriage return
* followed immediately by a line feed, or by reaching the end-of-file
* (EOF).
*
* @return A String containing the contents of the line, not including
* any line-termination characters, or null if the end of the
* stream has been reached
* stream has been reached without reading any characters
*
* @exception IOException If an I/O error occurs
*

View File

@ -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 @@ class FileInputStream extends InputStream
* 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

View File

@ -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
* <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) {

View File

@ -2348,6 +2348,7 @@ public abstract class ClassLoader {
this.isBuiltin = isBuiltin;
}
@SuppressWarnings("deprecation")
protected void finalize() {
synchronized (loadedLibraryNames) {
if (fromClass.getClassLoader() != null && loaded) {

View File

@ -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<E extends Enum<E>>
/**
* enum classes cannot have finalize methods.
*/
@SuppressWarnings("deprecation")
protected final void finalize() { }
/**

View File

@ -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 @@ public class Object {
* 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 a 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 { }
}

View File

@ -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();
}

View File

@ -927,7 +927,7 @@ class Thread implements Runnable {
* for example), the <code>interrupt</code> method should be used to
* interrupt the wait.
* For more information, see
* <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
@Deprecated(since="1.2")
@ -960,7 +960,7 @@ class Thread implements Runnable {
* could be used to generate exceptions that the target thread was
* not prepared to handle.
* For more information, see
* <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
* This method is subject to removal in a future version of Java SE.
*/
@ -1082,7 +1082,7 @@ class Thread implements Runnable {
* If another thread ever attempted to lock this resource, deadlock
* would result. Such deadlocks typically manifest themselves as
* "frozen" processes. For more information, see
* <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">
* Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
* This method is subject to removal in a future version of Java SE.
* @throws NoSuchMethodError always
@ -1122,7 +1122,7 @@ class Thread implements Runnable {
* monitor prior to calling <code>resume</code>, deadlock results. Such
* deadlocks typically manifest themselves as "frozen" processes.
* For more information, see
* <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
@Deprecated(since="1.2")
@ -1148,7 +1148,7 @@ class Thread implements Runnable {
* @deprecated This method exists solely for use with {@link #suspend},
* which has been deprecated because it is deadlock-prone.
* For more information, see
* <a href="{@docRoot}/../technotes/guides/concurrency/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
@Deprecated(since="1.2")

View File

@ -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
@ -28,7 +28,7 @@ package java.lang.annotation;
/**
* The constants of this enumerated type provide a simple classification of the
* syntactic locations where annotations may appear in a Java program. These
* constants are used in {@link Target java.lang.annotation.Target}
* constants are used in {@link java.lang.annotation.Target Target}
* meta-annotations to specify where it is legal to write annotations of a
* given type.
*

View File

@ -0,0 +1,364 @@
<!--
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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Java Thread Primitive Deprecation</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<h2>Java Thread Primitive Deprecation</h2>
<hr size="3" noshade="noshade" />
<h3>Why is <code>Thread.stop</code> deprecated?</h3>
<p>Because it is inherently unsafe. Stopping a thread causes it to
unlock all the monitors that it has locked. (The monitors are
unlocked as the <code>ThreadDeath</code> exception propagates up
the stack.) If any of the objects previously protected by these
monitors were in an inconsistent state, other threads may now view
these objects in an inconsistent state. Such objects are said to be
<i>damaged</i>. When threads operate on damaged objects, arbitrary
behavior can result. This behavior may be subtle and difficult to
detect, or it may be pronounced. Unlike other unchecked exceptions,
<code>ThreadDeath</code> kills threads silently; thus, the user has
no warning that his program may be corrupted. The corruption can
manifest itself at any time after the actual damage occurs, even
hours or days in the future.</p>
<hr />
<h3>Couldn't I just catch the <code>ThreadDeath</code> exception
and fix the damaged object?</h3>
<p>In theory, perhaps, but it would <em>vastly</em> complicate the
task of writing correct multithreaded code. The task would be
nearly insurmountable for two reasons:</p>
<ol>
<li>A thread can throw a <code>ThreadDeath</code> exception
<i>almost anywhere</i>. All synchronized methods and blocks would
have to be studied in great detail, with this in mind.</li>
<li>A thread can throw a second <code>ThreadDeath</code> exception
while cleaning up from the first (in the <code>catch</code> or
<code>finally</code> clause). Cleanup would have to be repeated till
it succeeded. The code to ensure this would be quite complex.</li>
</ol>
In sum, it just isn't practical.
<hr />
<h3>What about <code>Thread.stop(Throwable)</code>?</h3>
<p>In addition to all of the problems noted above, this method may
be used to generate exceptions that its target thread is unprepared
to handle (including checked exceptions that the thread could not
possibly throw, were it not for this method). For example, the
following method is behaviorally identical to Java's
<code>throw</code> operation, but circumvents the compiler's
attempts to guarantee that the calling method has declared all of
the checked exceptions that it may throw:</p>
<pre>
static void sneakyThrow(Throwable t) {
Thread.currentThread().stop(t);
}
</pre>
<hr />
<h3>What should I use instead of <code>Thread.stop</code>?</h3>
<p>Most uses of <code>stop</code> should be replaced by code that
simply modifies some variable to indicate that the target thread
should stop running. The target thread should check this variable
regularly, and return from its run method in an orderly fashion if
the variable indicates that it is to stop running. To ensure prompt
communication of the stop-request, the variable must be
<tt>volatile</tt> (or access to the variable must be
synchronized).</p>
<p>For example, suppose your applet contains the following
<code>start</code>, <code>stop</code> and <code>run</code>
methods:</p>
<pre>
private Thread blinker;
public void start() {
blinker = new Thread(this);
blinker.start();
}
public void stop() {
blinker.stop(); // UNSAFE!
}
public void run() {
while (true) {
try {
Thread.sleep(interval);
} catch (InterruptedException e){
}
repaint();
}
}
</pre>
You can avoid the use of <code>Thread.stop</code> by replacing the
applet's <code>stop</code> and <code>run</code> methods with:
<pre>
private volatile Thread blinker;
public void stop() {
blinker = null;
}
public void run() {
Thread thisThread = Thread.currentThread();
while (blinker == thisThread) {
try {
Thread.sleep(interval);
} catch (InterruptedException e){
}
repaint();
}
}
</pre>
<hr />
<h3>How do I stop a thread that waits for long periods (e.g., for
input)?</h3>
<p>That's what the <code>Thread.interrupt</code> method is for. The
same "state based" signaling mechanism shown above can be used, but
the state change (<code>blinker = null</code>, in the previous
example) can be followed by a call to
<code>Thread.interrupt</code>, to interrupt the wait:</p>
<pre>
public void stop() {
Thread moribund = waiter;
waiter = null;
moribund.interrupt();
}
</pre>
For this technique to work, it's critical that any method that
catches an interrupt exception and is not prepared to deal with it
immediately reasserts the exception. We say <em>reasserts</em>
rather than <em>rethrows</em>, because it is not always possible to
rethrow the exception. If the method that catches the
<code>InterruptedException</code> is not declared to throw this
(checked) exception, then it should "reinterrupt itself" with the
following incantation:
<pre>
Thread.currentThread().interrupt();
</pre>
This ensures that the Thread will reraise the
<code>InterruptedException</code> as soon as it is able.
<hr />
<h3>What if a thread doesn't respond to
<code>Thread.interrupt</code>?</h3>
<p>In some cases, you can use application specific tricks. For
example, if a thread is waiting on a known socket, you can close
the socket to cause the thread to return immediately.
Unfortunately, there really isn't any technique that works in
general. <em>It should be noted that in all situations where a
waiting thread doesn't respond to <code>Thread.interrupt</code>, it
wouldn't respond to <code>Thread.stop</code> either.</em> Such
cases include deliberate denial-of-service attacks, and I/O
operations for which thread.stop and thread.interrupt do not work
properly.</p>
<hr />
<h3>Why are <code>Thread.suspend</code> and
<code>Thread.resume</code> deprecated?</h3>
<p><code>Thread.suspend</code> is inherently deadlock-prone. If the
target thread holds a lock on the monitor protecting a critical
system resource when it is suspended, no thread can access this
resource until the target thread is resumed. If the thread that
would resume the target thread attempts to lock this monitor prior
to calling <code>resume</code>, deadlock results. Such deadlocks
typically manifest themselves as "frozen" processes.</p>
<hr />
<h3>What should I use instead of <code>Thread.suspend</code> and
<code>Thread.resume</code>?</h3>
<p>As with <code>Thread.stop</code>, the prudent approach is to
have the "target thread" poll a variable indicating the desired
state of the thread (active or suspended). When the desired state
is suspended, the thread waits using <code>Object.wait</code>. When
the thread is resumed, the target thread is notified using
<code>Object.notify</code>.</p>
<p>For example, suppose your applet contains the following
mousePressed event handler, which toggles the state of a thread
called <code>blinker</code>:</p>
<pre>
private boolean threadSuspended;
Public void mousePressed(MouseEvent e) {
e.consume();
if (threadSuspended)
blinker.resume();
else
blinker.suspend(); // DEADLOCK-PRONE!
threadSuspended = !threadSuspended;
}
</pre>
You can avoid the use of <code>Thread.suspend</code> and
<code>Thread.resume</code> by replacing the event handler above
with:
<pre>
public synchronized void mousePressed(MouseEvent e) {
e.consume();
threadSuspended = !threadSuspended;
if (!threadSuspended)
notify();
}
</pre>
and adding the following code to the "run loop":
<pre>
synchronized(this) {
while (threadSuspended)
wait();
}
</pre>
The <code>wait</code> method throws the
<code>InterruptedException</code>, so it must be inside a <code>try
... catch</code> clause. It's fine to put it in the same clause as
the <code>sleep</code>. The check should follow (rather than
precede) the <code>sleep</code> so the window is immediately
repainted when the thread is "resumed." The resulting
<code>run</code> method follows:
<pre>
public void run() {
while (true) {
try {
Thread.sleep(interval);
synchronized(this) {
while (threadSuspended)
wait();
}
} catch (InterruptedException e){
}
repaint();
}
}
</pre>
Note that the <code>notify</code> in the <code>mousePressed</code>
method and the <code>wait</code> in the <code>run</code> method are
inside <code>synchronized</code> blocks. This is required by the
language, and ensures that <code>wait</code> and
<code>notify</code> are properly serialized. In practical terms,
this eliminates race conditions that could cause the "suspended"
thread to miss a <code>notify</code> and remain suspended
indefinitely.
<p>While the cost of synchronization in Java is decreasing as the
platform matures, it will never be free. A simple trick can be used
to remove the synchronization that we've added to each iteration of
the "run loop." The synchronized block that was added is replaced
by a slightly more complex piece of code that enters a synchronized
block only if the thread has actually been suspended:</p>
<pre>
if (threadSuspended) {
synchronized(this) {
while (threadSuspended)
wait();
}
}
</pre>
<p>In the absence of explicit synchronization,
<tt>threadSuspended</tt> must be made <tt>volatile</tt> to ensure
prompt communication of the suspend-request.</p>
The resulting <code>run</code> method is:
<pre>
private volatile boolean threadSuspended;
public void run() {
while (true) {
try {
Thread.sleep(interval);
if (threadSuspended) {
synchronized(this) {
while (threadSuspended)
wait();
}
}
} catch (InterruptedException e){
}
repaint();
}
}
</pre>
<hr size="3" noshade="noshade" />
<h3>Can I combine the two techniques to produce a thread that may
be safely "stopped" or "suspended"?</h3>
Yes, it's reasonably straightforward. The one subtlety is that the
target thread may already be suspended at the time that another
thread tries to stop it. If the <tt>stop</tt> method merely sets
the state variable (<tt>blinker</tt>) to null, the target thread
will remain suspended (waiting on the monitor), rather than exiting
gracefully as it should. If the applet is restarted, multiple
threads could end up waiting on the monitor at the same time,
resulting in erratic behavior.
<p>To rectify this situation, the <tt>stop</tt> method must ensure
that the target thread resumes immediately if it is suspended. Once
the target thread resumes, it must recognize immediately that it
has been stopped, and exit gracefully. Here's how the resulting
<tt>run</tt> and <tt>stop</tt> methods look:</p>
<pre>
public void run() {
Thread thisThread = Thread.currentThread();
while (blinker == thisThread) {
try {
Thread.sleep(interval);
synchronized(this) {
while (threadSuspended &amp;&amp; blinker==thisThread)
wait();
}
} catch (InterruptedException e){
}
repaint();
}
}
public synchronized void stop() {
blinker = null;
notify();
}
</pre>
If the <tt>stop</tt> method calls <tt>Thread.interrupt</tt>, as
described above, it needn't call <tt>notify</tt> as well, but it
still must be synchronized. This ensures that the target thread
won't miss an interrupt due to a race condition.
<hr />
<h3>What about <code>Thread.destroy</code>?</h3>
<code>Thread.destroy</code> was never implemented and has been
deprecated. If it were implemented, it would be deadlock-prone in
the manner of <code>Thread.suspend</code>. (In fact, it is roughly
equivalent to <code>Thread.suspend</code> without the possibility
of a subsequent <code>Thread.resume</code>.)
<hr />
<h3>Why is <code>Runtime.runFinalizersOnExit</code>
deprecated?</h3>
Because it is inherently unsafe. It may result in finalizers being
called on live objects while other threads are concurrently
manipulating those objects, resulting in erratic behavior or
deadlock. While this problem could be prevented if the class whose
objects are being finalized were coded to "defend against" this
call, most programmers do <i>not</i> defend against it. They assume
that an object is dead at the time that its finalizer is called.
<p>Further, the call is not "thread-safe" in the sense that it sets
a VM-global flag. This forces <i>every</i> class with a finalizer
to defend against the finalization of live objects!</p>
<p><!-- Body text ends here --></p>
</body>
</html>

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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() {}
/**

View File

@ -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() {}
/**

View File

@ -1836,7 +1836,7 @@ public abstract class ResourceBundle {
cacheKey.setFormat(format);
break;
}
} catch (Exception e) {
} catch (LinkageError|Exception e) {
cacheKey.setCause(e);
}
}

View File

@ -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;

View File

@ -713,6 +713,7 @@ public class Executors {
FinalizableDelegatedExecutorService(ExecutorService executor) {
super(executor);
}
@SuppressWarnings("deprecation")
protected void finalize() {
super.shutdown();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();

View File

@ -39,7 +39,8 @@ java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n
java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\
java.launcher.opt.footer = \
\ -cp <class search path of directories and zip/jar files>\n\
\ -classpath <class search path of directories and zip/jar files>\n\
\ --class-path <class search path of directories and zip/jar files>\n\
\ A {0} separated list of directories, JAR archives,\n\
@ -101,8 +102,11 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
\ should always be passed as the argument to the -splash option.\n\
\ The most appropriate scaled image provided will be picked up\n\
\ automatically.\n\
\ See the SplashScreen API documentation for more information.\n\
\ @<filepath> read options from the specified file\n\n\
\ See the SplashScreen API documentation for more information\n\
\ @argument files\n\
\ one or more argument files containing options\n\
\ -disable-@files\n\
\ prevent further argument file expansion\n\
\To specify an argument for a long option, you can use --<name>=<value> or\n\
\--<name> <value>.\n

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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)

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -124,6 +124,7 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
}
@Override
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
super.finalize();

View File

@ -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);

View File

@ -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);

View File

@ -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();
}

View File

@ -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) {

View File

@ -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)

View File

@ -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)

View File

@ -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) {

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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
}

View File

@ -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();
}

View File

@ -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() {
}

View File

@ -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();
}

View File

@ -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() {
}

View File

@ -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() {
}

View File

@ -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();

View File

@ -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.

View File

@ -664,7 +664,7 @@ public class Logger {
* a new logger is created.
* <p>
* If a new logger is created its log level will be configured
* based on the LogManager configuration and it will configured
* based on the LogManager configuration and it will be configured
* to also send logging output to its parent's Handlers. It will
* be registered in the LogManager global namespace.
* <p>
@ -726,7 +726,7 @@ public class Logger {
*
* <p>
* If a new logger is created its log level will be configured
* based on the LogManager and it will configured to also send logging
* based on the LogManager and it will be configured to also send logging
* output to its parent's Handlers. It will be registered in
* the LogManager global namespace.
* <p>

View File

@ -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<T extends NameClassPair>
listArg = ne.listArg;
}
@SuppressWarnings("deprecation")
protected final void finalize() {
cleanup();
}

View File

@ -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 @@ public final class LdapClient implements PooledConnection {
}
}
@SuppressWarnings("deprecation")
protected void finalize() {
if (debug > 0) System.err.println("LdapClient: finalize " + this);
forceClose(pooled);

View File

@ -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 @@ final public class LdapCtx extends ComponentDirContext
// ----------------- Connection ---------------------
@SuppressWarnings("deprecation")
protected void finalize() {
try {
close();

View File

@ -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 @@ final class DefaultCallbackHandler implements CallbackHandler {
}
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
clearPassword();
}

View File

@ -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 @@ class LogInputStream extends InputStream {
/**
* Closes the stream when garbage is collected.
*/
@SuppressWarnings("deprecation")
protected void finalize() throws IOException {
close();
}

View File

@ -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 @@ final class ConnectionMultiplexer {
/**
* Shut down connection upon finalization.
*/
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable
{
super.finalize();

View File

@ -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 @@ public class GSSCredElement implements GSSCredentialSpi {
return "N/A";
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
dispose();
}

View File

@ -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 @@ public class GSSNameElement implements GSSNameSpi {
}
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
dispose();
}

View File

@ -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 @@ class NativeGSSContext implements GSSContextSpi {
return isInitiator;
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
dispose();
}

View File

@ -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 @@ abstract class CramMD5Base {
}
}
@SuppressWarnings("deprecation")
protected void finalize() {
clearPassword();
}

View File

@ -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 @@ final class PlainClient implements SaslClient {
}
}
@SuppressWarnings("deprecation")
protected void finalize() {
clearPassword();
}

View File

@ -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 @@ final class CardImpl extends Card {
+ ", protocol " + getProtocol() + ", state " + state;
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
if (state == State.OK) {

View File

@ -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 @@ final class P11KeyStore extends KeyStoreSpi {
pc.setPassword(password); // this clones the password if not null
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
if (password != null) {
Arrays.fill(password, ' ');

View File

@ -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 @@ public class PKCS11 {
*
* @exception Throwable If finalization fails.
*/
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
disconnect();
}

View File

@ -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 @@ abstract class Key implements java.security.Key, Length
/**
* Finalization method
*/
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable
{
try {

View File

@ -306,6 +306,7 @@ public class ConsoleReader
* Shuts down the ConsoleReader if the JVM attempts to clean it up.
*/
@Override
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
shutdown();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -74,7 +74,7 @@ public abstract class EditingHistory implements History {
//in.resetPromptLine(in.getPrompt(), in.getHistory().current().toString(), -1);
//but that would mean more re-writing on the screen, (and prints an additional
//empty line), so using setBuffer directly:
Method setBuffer = in.getClass().getDeclaredMethod("setBuffer", String.class);
Method setBuffer = ConsoleReader.class.getDeclaredMethod("setBuffer", String.class);
setBuffer.setAccessible(true);
setBuffer.invoke(in, in.getHistory().current().toString());

View File

@ -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 @@ public class DnsClient {
resps = Collections.synchronizedMap(new HashMap<Integer, byte[]>());
}
@SuppressWarnings("deprecation")
protected void finalize() {
close();
}

View File

@ -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 @@ public class RegistryContext implements Context, Referenceable {
reference = ctx.reference;
}
@SuppressWarnings("deprecation")
protected void finalize() {
close();
}
@ -593,6 +594,7 @@ class BindingEnumeration implements NamingEnumeration<Binding> {
nextName = 0;
}
@SuppressWarnings("deprecation")
protected void finalize() {
ctx.close();
}
@ -633,6 +635,7 @@ class BindingEnumeration implements NamingEnumeration<Binding> {
}
}
@SuppressWarnings("deprecation")
public void close () {
finalize();
}

View File

@ -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 @@ abstract class GssKrb5Base extends AbstractSaslImpl {
}
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
dispose();
}

View File

@ -936,6 +936,7 @@ class ZipFileSystem extends FileSystem {
return zc.toString(name);
}
@SuppressWarnings("deprecation")
protected void finalize() throws IOException {
close();
}

View File

@ -284,8 +284,6 @@ com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows-
java/util/BitSet/BitSetStreamTest.java 8079538 generic-all
jdk/internal/util/jar/TestVersionedStream.java 8177640 windows-all
############################################################################
# jdk_instrument

View File

@ -1,13 +1,38 @@
/** hard coded linenumbers in other tests - DO NOT CHANGE
* @test/nodynamiccopyright/
* @bug 4490824
* @summary JDI: provide arguments when no debug attributes present
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @author jjh
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile ArgumentValuesTest.java
* @run driver ArgumentValuesTest
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// THIS TEST IS LINE NUMBER SENSITIVE
/**
* @test
* @bug 4490824
* @summary JDI: provide arguments when no debug attributes present
*
* @author jjh
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile ArgumentValuesTest.java
* @run driver ArgumentValuesTest
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
@ -35,26 +60,26 @@ class ArgumentValuesTarg {
static List<Integer> intList;
public static void noArgs() {
int index = 0; // line 38
int index = 0; // line NO_ARGS_LINE_1
}
public static void allArgs(char p_char, byte p_byte, short p_short,
int p_int, long p_long, float p_float,
double p_double, int p_iarray[], int p_marray[][],
String p_sarray1[], String p_string) {
int index = 0; // line 45
int index = 0; // line ALL_ARGS_LINE_1
}
public static void varArgs(String ... p1) {
int index = 0; // line 49
int index = 0; // line VAR_ARGS_LINE_1
}
public static void genericArgs(List<Integer> p1) {
int index = 0; // line 53
int index = 0; // line GENERIC_ARGS_LINE_1
}
public void instanceMethod(char p_char, byte p_byte) {
int index = 0; // line 57
int index = 0; // line INSTANCE_METHOD_LINE_1
}
public static void main(String[] args) {
@ -81,6 +106,12 @@ class ArgumentValuesTarg {
/********** test program **********/
public class ArgumentValuesTest extends TestScaffold {
static final int NO_ARGS_LINE_1 = 63;
static final int ALL_ARGS_LINE_1 = 70;
static final int VAR_ARGS_LINE_1 = 74;
static final int GENERIC_ARGS_LINE_1 = 78;
static final int INSTANCE_METHOD_LINE_1 = 82;
// Must be in same order as args to allArgs(....)
String fieldNames[] = {"s_char1", "s_byte1", "s_short1", "s_int1",
"s_long1", "s_float1", "s_double1", "s_iarray1",
@ -118,7 +149,7 @@ public class ArgumentValuesTest extends TestScaffold {
{
System.out.println("----- Testing each type of arg");
bpe = resumeTo("ArgumentValuesTarg", 45);
bpe = resumeTo("ArgumentValuesTarg", ALL_ARGS_LINE_1);
StackFrame frame = bpe.thread().frame(0);
Method mmm = frame.location().method();
@ -147,7 +178,7 @@ public class ArgumentValuesTest extends TestScaffold {
// a method with no params
{
System.out.println("----- Testing no args");
bpe = resumeTo("ArgumentValuesTarg", 38);
bpe = resumeTo("ArgumentValuesTarg", NO_ARGS_LINE_1);
StackFrame frame = bpe.thread().frame(0);
Method mmm = frame.location().method();
@ -165,7 +196,7 @@ public class ArgumentValuesTest extends TestScaffold {
// as a String[3] in the method.
{
System.out.println("----- Testing var args");
bpe = resumeTo("ArgumentValuesTarg", 49);
bpe = resumeTo("ArgumentValuesTarg", VAR_ARGS_LINE_1);
StackFrame frame = bpe.thread().frame(0);
Method mmm = frame.location().method();
@ -199,7 +230,7 @@ public class ArgumentValuesTest extends TestScaffold {
// a method with with one generic param
{
System.out.println("----- Testing generic args");
bpe = resumeTo("ArgumentValuesTarg", 53);
bpe = resumeTo("ArgumentValuesTarg", GENERIC_ARGS_LINE_1);
StackFrame frame = bpe.thread().frame(0);
Method mmm = frame.location().method();
@ -224,7 +255,7 @@ public class ArgumentValuesTest extends TestScaffold {
// test instance method call
{
System.out.println("----- Testing instance method call");
bpe = resumeTo("ArgumentValuesTarg", 57);
bpe = resumeTo("ArgumentValuesTarg", INSTANCE_METHOD_LINE_1);
StackFrame frame = bpe.thread().frame(0);
Method mmm = frame.location().method();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, 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
@ -21,19 +21,20 @@
* questions.
*/
// THIS TEST IS LINE NUMBER SENSITIVE
/**
* @test
* @bug 6496524
* @summary Setting breakpoint in jdb crashes Hotspot JVM
* @test
* @bug 6496524
* @key intermittent
* @summary Setting breakpoint in jdb crashes Hotspot JVM
* @author jjh
*
* @author jjh
*
* @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g BreakpointTest.java
* @run driver BreakpointTest
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g BreakpointTest.java
* @run driver BreakpointTest
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
import com.sun.jdi.request.*;
@ -47,7 +48,6 @@ import java.util.*;
class BreakpointTarg {
public final static int BKPT_LINE = 56;
// LINE NUMBER SENSITIVE
public static long count;
static void doit() {

View File

@ -1,13 +1,37 @@
/** hard coded linenumbers in test - DO NOT CHANGE
* @test/nodynamiccopyright/
* @bug 4386002 4429245
* @summary Test fix for: Incorrect values reported for some locals of type long
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @author Tim Bell
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g FetchLocals.java
* @run driver FetchLocals
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// THIS TEST IS LINE NUMBER SENSITIVE
/**
* @test
* @bug 4386002 4429245
* @summary Test fix for: Incorrect values reported for some locals of type long
* @author Tim Bell
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g FetchLocals.java
* @run driver FetchLocals
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
@ -59,7 +83,7 @@ class FetchLocalsDebugee {
System.out.println(f);
System.out.print("d is: ");
System.out.println(d);
System.out.println(); // Thie is Line 63...
System.out.println(); // This is FetchLocals::LINE
if (w == 0xde00ad00be00ef00L) {
System.out.print ("The debugger was here. w modified to: 0x");
System.out.println(Long.toHexString(w));
@ -87,6 +111,7 @@ class FetchLocalsDebugee {
}
public class FetchLocals extends TestScaffold {
static final int LINE = 86;
FetchLocals (String args[]) {
super(args);
@ -355,7 +380,7 @@ public class FetchLocals extends TestScaffold {
* Get to the bottom of testMethod():
*/
try {
BreakpointEvent bpe = resumeTo("FetchLocalsDebugee", 63);
BreakpointEvent bpe = resumeTo("FetchLocalsDebugee", LINE);
/*
* Fetch values from fields; what did we get?
*/

View File

@ -1,14 +1,39 @@
/** hard coded linenumbers in this test - DO NOT CHANGE
* @test/nodynamiccopyright/
* @bug 4359312 4450091
* @summary Test PTR 1421 JVM exceptions making a call to LocalVariable.type().name()
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @author Tim Bell (based on the PTR 1421 report submitted by IBM).
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g GetLocalVariables.java
* @run driver GetLocalVariables
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// THIS TEST IS LINE NUMBER SENSITIVE
/**
* @test
* @bug 4359312 4450091
* @summary Test PTR 1421 JVM exceptions making a call to LocalVariable.type().name()
* @author Tim Bell (based on the PTR 1421 report submitted by IBM).
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g GetLocalVariables.java
* @run driver GetLocalVariables
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
import com.sun.jdi.request.*;
@ -194,7 +219,7 @@ class GetLocalVariablesTarg {
l_long, l_float, l_double, l_iarray,
l_marray, l_string);
e1.test_1(); // <-- this is line 197
e1.test_1(); // RESUME_TO_LINE
e3.test_1();
e4.test_1();
e5.test_1();
@ -231,6 +256,7 @@ class GetLocalVariablesTarg {
/********** test program **********/
public class GetLocalVariables extends TestScaffold {
static final int RESUME_TO_LINE = 222;
ReferenceType targetClass;
ThreadReference mainThread;
@ -257,7 +283,7 @@ public class GetLocalVariables extends TestScaffold {
mainThread = bpe.thread();
EventRequestManager erm = vm().eventRequestManager();
bpe = resumeTo("GetLocalVariablesTarg", 197);
bpe = resumeTo("GetLocalVariablesTarg", RESUME_TO_LINE);
/*
* We've arrived. Look around at some variables.
*/

View File

@ -1,13 +1,37 @@
/** hard coded linenumbers in other tests - DO NOT CHANGE
* @test/nodynamiccopyright/
* @bug 4300412
* @summary Test GetLocal* and SetLocal* functions
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @author Serguei Spitsyn
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g GetSetLocalTest.java
* @run driver GetSetLocalTest
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// THIS TEST IS LINE NUMBER SENSITIVE
/**
* @test
* @bug 4300412
* @summary Test GetLocal* and SetLocal* functions
* @author Serguei Spitsyn
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g GetSetLocalTest.java
* @run driver GetSetLocalTest
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
@ -35,7 +59,7 @@ class GetSetLocalTarg {
int result;
{
{ boolean bool_1 = false;
intArg++;
intArg++; // START_LINE
}
boolean bool_2 = true;
@ -111,7 +135,7 @@ class GetSetLocalTarg {
}
Object obj_2 = new Object();
intArg++; // <-- Last stop is at this point.
intArg++; // STOP_LINE. Last stop is at this point.
// Only obj_2 and intArg are valid
// Note: even result is not valid here!
}
@ -125,6 +149,8 @@ class GetSetLocalTarg {
/********** test program **********/
public class GetSetLocalTest extends TestScaffold {
static final int START_LINE = 62;
static final int STOP_LINE = 138;
ReferenceType targetClass;
ThreadReference mainThread;
@ -635,7 +661,7 @@ public class GetSetLocalTest extends TestScaffold {
println("EventRequestManager");
StackFrame frame = null;
for (int line = 38; line < 118; line += 4) {
for (int line = START_LINE; line <= STOP_LINE; line += 4) {
println("\n resumeTo(GetSetLocalTarg, " + line + ")");
bpe = resumeTo("GetSetLocalTarg", line);
frame = bpe.thread().frame(0);

Some files were not shown because too many files have changed in this diff Show More