This test fails when additional threads are created, as it compares thread lists from different sources and sees a mismatch.
It needs to tolerate some threads with certain names appearing, e.g. JVMCI and ForkJoin threads. If there are extra threads in the thread ID list from the ThreadMBean, remove them from the thread count before comparing. When it fails, additionally print the ids and names of threads that it got from the MBean. I found the test quite confusing, the naming of thread counts, arrays of threads, and arrays of thread stacktraces from different sources, so have renamed some things. ------------- Commit messages: - More concise printing of thread id+name on failure. - Merge remote-tracking branch 'upstream/master' into 8303916_ThreadLists_test - 8303916: ThreadLists.java inconsistent results Changes: https://git.openjdk.org/jdk/pull/14465/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14465&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8303916 Stats: 77 lines in 1 file changed: 54 ins; 1 del; 22 mod Patch: https://git.openjdk.org/jdk/pull/14465.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14465/head:pull/14465 PR: https://git.openjdk.org/jdk/pull/14465