RFR: 8356811: Some nsk/jdi tests can fetch ThreadReference from static field in the debuggee: part 4
Chris Plummer
cjplummer at openjdk.org
Mon May 12 21:06:13 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.
-------------
Commit messages:
- fix jcheck errors
- update copyrights
- minor fixes
- Add and use new threadByFieldName() APIs
- Use threadByFieldNameOrThrow()
Changes: https://git.openjdk.org/jdk/pull/25190/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25190&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8356811
Stats: 592 lines in 74 files changed: 253 ins; 90 del; 249 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