RFR: 8356811: Some nsk/jdi tests can fetch ThreadReference from static field in the debuggee: part 4 [v2]
Serguei Spitsyn
sspitsyn at openjdk.org
Fri May 16 18:23:55 UTC 2025
On Thu, 15 May 2025 22:49:45 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> 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()
I also noticed this issue with exceptions but waited you to sort this out with Alex first.
I'm okay to separate it from this PR. Current PR looks good then.
-------------
Marked as reviewed by sspitsyn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25190#pullrequestreview-2847347180
More information about the serviceability-dev
mailing list