From b2a5271e7451a7546a8293fc4bc4ccfaa1ffb0d7 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 8 Jun 2023 17:28:04 +0000 Subject: [PATCH] 8309196: Remove Thread.countStackFrames Reviewed-by: rriggs, mchung, dholmes, jpai, iris --- .../share/classes/java/lang/Thread.java | 16 ---------------- .../lang/Thread/DegradedMethodsThrowUOE.java | 7 +++---- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index 64c124a842a..a2817f56168 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -2011,22 +2011,6 @@ public class Thread implements Runnable { return currentThread().getThreadGroup().enumerate(tarray); } - /** - * Throws {@code UnsupportedOperationException}. - * - * @return nothing - * - * @deprecated This method was originally designed to count the number of - * stack frames but the results were never well-defined and it - * depended on thread-suspension. - * This method is subject to removal in a future version of Java SE. - * @see StackWalker - */ - @Deprecated(since="1.2", forRemoval=true) - public int countStackFrames() { - throw new UnsupportedOperationException(); - } - /** * Waits at most {@code millis} milliseconds for this thread to terminate. * A timeout of {@code 0} means to wait forever. diff --git a/test/jdk/java/lang/Thread/DegradedMethodsThrowUOE.java b/test/jdk/java/lang/Thread/DegradedMethodsThrowUOE.java index e3141b02fdd..b16b70eaff0 100644 --- a/test/jdk/java/lang/Thread/DegradedMethodsThrowUOE.java +++ b/test/jdk/java/lang/Thread/DegradedMethodsThrowUOE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -23,7 +23,7 @@ /* @test * @bug 8289610 8249627 8205132 - * @summary Test that Thread stop/suspend/resume/countStackFrames throw UOE + * @summary Test that Thread stop/suspend/resume throw UOE * @run junit DegradedMethodsThrowUOE */ @@ -45,8 +45,7 @@ class DegradedMethodsThrowUOE { return Stream.>of( Thread::stop, Thread::suspend, - Thread::resume, - Thread::countStackFrames + Thread::resume ); }