RFR: 8356811: Some nsk/jdi tests can fetch ThreadReference from static field in the debuggee: part 4 [v2]

Chris Plummer cjplummer at openjdk.org
Thu May 15 22:49:45 UTC 2025


> This batch of changes mostly concerns the remaining uses of threadByName() and converting them to use threadByFieldNameOrThrow() or the new threadByFieldName(). The latter is used if the caller has code to handle a null result. The former is when an exception is needed to get the test to terminate properly. I did fix a few long standing cases where threadyByName() was being called and not checking the result. These call sites now use threadByFieldNameOrThrow() instead of threadByFieldName().
> 
> Note there is a minor semantic change in doing this. threadByName() has some extra code to check that the named thread is only found once, and will throw an exception if it is. I think this was just some extra checking that was being done during test development, and is not needed for proper test execution. I've run all the tests without this check and they still pass. I plan on removing this check at some point. 
> 
> Tested by running all tier5 svc tests, which includes the nsk/jdi tests. Also ran tier1 and ran locally.

Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:

  fix comment to reference threadByFieldName()

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25190/files
  - new: https://git.openjdk.org/jdk/pull/25190/files/6ab78d6d..f5d18f8a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25190&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25190&range=00-01

  Stats: 26 lines in 25 files changed: 0 ins; 0 del; 26 mod
  Patch: https://git.openjdk.org/jdk/pull/25190.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25190/head:pull/25190

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


More information about the serviceability-dev mailing list