8231602: Deprecate Thread.suspend/resume for removal
Reviewed-by: mchung, dholmes, chegar
--- a/src/java.base/share/classes/java/lang/Thread.java Thu Oct 24 11:49:56 2019 +0200
+++ b/src/java.base/share/classes/java/lang/Thread.java Thu Oct 24 11:07:31 2019 +0100
@@ -1075,7 +1075,7 @@
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
- @Deprecated(since="1.2")
+ @Deprecated(since="1.2", forRemoval=true)
public final void suspend() {
checkAccess();
suspend0();
@@ -1101,7 +1101,7 @@
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
- @Deprecated(since="1.2")
+ @Deprecated(since="1.2", forRemoval=true)
public final void resume() {
checkAccess();
resume0();
--- a/src/java.base/share/classes/java/lang/ThreadGroup.java Thu Oct 24 11:49:56 2019 +0200
+++ b/src/java.base/share/classes/java/lang/ThreadGroup.java Thu Oct 24 11:07:31 2019 +0100
@@ -666,8 +666,8 @@
* @deprecated This method is inherently deadlock-prone. See
* {@link Thread#suspend} for details.
*/
- @Deprecated(since="1.2")
- @SuppressWarnings("deprecation")
+ @Deprecated(since="1.2", forRemoval=true)
+ @SuppressWarnings("removal")
public final void suspend() {
if (stopOrSuspend(true))
Thread.currentThread().suspend();
@@ -680,7 +680,7 @@
* if (and only if) the current thread is found to be in this thread
* group or one of its subgroups.
*/
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({"deprecation", "removal"})
private boolean stopOrSuspend(boolean suspend) {
boolean suicide = false;
Thread us = Thread.currentThread();
@@ -729,8 +729,8 @@
* both of which have been deprecated, as they are inherently
* deadlock-prone. See {@link Thread#suspend} for details.
*/
- @Deprecated(since="1.2")
- @SuppressWarnings("deprecation")
+ @Deprecated(since="1.2", forRemoval=true)
+ @SuppressWarnings("removal")
public final void resume() {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
@@ -1070,7 +1070,7 @@
* which is deprecated. Further, the behavior of this call
* was never specified.
*/
- @Deprecated(since="1.2")
+ @Deprecated(since="1.2", forRemoval=true)
public boolean allowThreadSuspension(boolean b) {
return true;
}