RFR: 8305186: Reference.waitForReferenceProcessing should be more accessible to tests [v3]
Brent Christian
bchristi at openjdk.org
Thu Apr 10 22:33:26 UTC 2025
On Thu, 10 Apr 2025 05:33:18 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Brent Christian has updated the pull request incrementally with one additional commit since the last revision:
>>
>> reflection improvements
>
> test/lib/jdk/test/whitebox/WhiteBox.java line 572:
>
>> 570: public static void waitForReferenceProcessing() {
>> 571: try {
>> 572: Method wfrp = Reference.class.getDeclaredMethod("waitForReferenceProcessing");
>
> Why was the caching of the method removed in the latest commit?
>
> It seems like it might be cleaner to split this into a helper that gets the Method object, with a catch clause
> for NoSuchMethodException. Such a helper would also be a place to verify/assert various properties of
> the found method, such as empty parameter list, return type is boolean, one declared exception type
> (InterruptedException), all of which can then be assumed by the invocation.
Thanks for posting your version; I used it as the basis for my latest patch.
I left the `assert`s, but would also be OK with throwing an exception if anything was not as expected.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24527#discussion_r2038442479
More information about the core-libs-dev
mailing list