Integrated: 8309196: Remove Thread.countStackFrames

Alan Bateman alanb at openjdk.org
Thu Jun 8 17:32:39 UTC 2023


On Thu, 1 Jun 2023 06:40:04 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Thread.countStackFrames is/was an ill-defined method that dates from JDK 1.0 for counting the stack frames of a suspended Thread. The method was deprecated in JDK 1.2 (1998), deprecated for removal in Java 9, and re-specified/degraded to throw UOE unconditionally in Java 14.  Java 22 would be a fine time to finally remove this method.
> 
> Code that wants to count stack frames should be directed to use j.l.StackWalker, or if a tool, then it can use JVM TI and other tool APIs.
> 
> A corpus analysis of 30M classes in 131k artifacts from Maven Central found only 1 usages to this method. The 1 usage appears to be a class that just wraps all methods, it doesn't actually make use of it.

This pull request has now been integrated.

Changeset: b2a5271e
Author:    Alan Bateman <alanb at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/b2a5271e7451a7546a8293fc4bc4ccfaa1ffb0d7
Stats:     20 lines in 2 files changed: 0 ins; 17 del; 3 mod

8309196: Remove Thread.countStackFrames

Reviewed-by: rriggs, mchung, dholmes, jpai, iris

-------------

PR: https://git.openjdk.org/jdk/pull/14257


More information about the core-libs-dev mailing list