On Thu, 13 Aug 2026 04:51:36 GMT, Shiv Shah <[email protected]> wrote:

>> The sleeping thread tests had a hardcoded list of jdk methods for checking 
>> the stack trace so changes to Thread.sleep often required updating the 
>> tests. Now they only require the java.lang.Thread.sleep entry frame and 
>> ignore whatever sits above it while the callers below still go through the 
>> existing expected methods. Calls to getThreadInfo without an explicit 
>> maximum depth return no stack, so those paths skip the frame content check. 
>> 
>> strace001 samples running threads rather than sleeping threads, so it has no 
>> Thread.sleep frame to use as a boundary. Instead, it finds the innermost 
>> frame belonging to the test and ignores frames above it. Its stack length 
>> check now uses the requested depth plus the expected method count instead of 
>> the hardcoded depth + 7 estimate, and an unexpectedly empty snapshot now 
>> fails instead of passing accidentally.
>> 
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Shiv Shah has updated the pull request with a new target base due to a merge 
> or a rebase. The incremental webrev excludes the unrelated changes brought in 
> by the merge/rebase. The pull request contains three additional commits since 
> the last revision:
> 
>  - Require the Thread.sleep entry frame instead of accepting any JDK frame
>  - Merge branch 'master' into JDK-8340088-v2
>  - 8340088: Stack tracing tests of sleeping thread should be more resilient 
> to code changes

I see. There are two SleepingThread classes, that are similar so both needed 
the new limited checkStackTrace method.  Not sure how you can reduce this code, 
so I approve of this change.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/31357#pullrequestreview-5022100204

Reply via email to