RFR: 8305186: Reference.waitForReferenceProcessing should be more accessible to tests [v5]
Brent Christian
bchristi at openjdk.org
Fri Apr 11 23:31:16 UTC 2025
On Fri, 11 Apr 2025 21:36:28 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Brent Christian has updated the pull request incrementally with one additional commit since the last revision:
>>
>> wFRP throws InterruptedException, pass through from InvocationTargetException; don't check param count
>
> test/lib/jdk/test/whitebox/WhiteBox.java line 568:
>
>> 566: private Method getWaitForReferenceProcessingMethod() {
>> 567: Method wfrp = waitForReferenceProcessingMethod;
>> 568: if (wfrp == null) {
>
> Racy initialization is fine, the field can be static and the last one (any racy init would all the same) wins:
> Suggestion:
>
> private static Method waitForReferenceProcessingMethod = getWaitForReferenceProcessingMethod();
>
> private static Method getWaitForReferenceProcessingMethod() {
I can make the `Method` static, but I don't think it should be set until there's a call to `getWaitForReferenceProcessing()`, as most uses of `WhiteBox` won't need it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24527#discussion_r2040420062
More information about the core-libs-dev
mailing list