On Fri, 11 Apr 2025 23:26:45 GMT, Brent Christian <bchri...@openjdk.org> wrote:
>> 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. Not only will most uses of `WhiteBox` not need it, but those uses would be "broken" because they would be forced to (without benefit) add the `@modules` declaration needed to allow that to work. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24527#discussion_r2040569359