RFR: 8305186: Reference.waitForReferenceProcessing should be more accessible to tests [v3]

Brent Christian bchristi at openjdk.org
Wed Apr 9 23:12:00 UTC 2025


On Tue, 8 Apr 2025 21:16:22 GMT, Roger Riggs <rriggs 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/lib/util/ForceGC.java line 125:
> 
>> 123:                 Method[] methods = refClass.getDeclaredMethods();
>> 124:                 wfrp = Arrays.stream(methods).filter((m) -> m.getName().equals("waitForReferenceProcessing")).findFirst().get();
>> 125:                 wfrp.setAccessible(true);
> 
> You don't need the stream.  
> Suggestion:
> 
>                 Method wfrp = Reference.class.getDeclaredMethod("waitForReferenceProcessing");
>                 wfrp.setAccessible(true);

Yes, that is better, thanks.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24527#discussion_r2036252717


More information about the core-libs-dev mailing list