On Fri, 11 Apr 2025 23:31:16 GMT, Brent Christian <bchri...@openjdk.org> wrote:
>> Certain specific types of tests involving GC and reference processing need >> to account for the delay between a GC completing (during which the GC clears >> a Reference), and the Reference being added to its associated queue. At >> present, ad hoc mechanisms (with delays/timeout) are used, but can lead to >> intermittent test failures >> ([JDK-8298783](https://bugs.openjdk.org/browse/JDK-8298783) is a recent >> example). >> >> A better mechanism already exists in the private >> `Reference.waitForReferenceProcessing()` method. This PR makes >> `waitForReferenceProcessing()` available to tests via the `WhiteBox` and >> `ForceGC` test libraries. > > Brent Christian has updated the pull request incrementally with two > additional commits since the last revision: > > - Make *the method* static, also > - Make Method static Changes requested by kbarrett (Reviewer). test/lib/jdk/test/whitebox/WhiteBox.java line 609: > 607: throw e; > 608: } catch (Throwable t) { > 609: throw new RuntimeException(t); The only checked exceptions that are thrown by the try-body are `InvocationTargetException` and `IllegalAccessException` (both from `Method::invoke`). The way `InvocationTargetException` is being handled here seems fine. But I think it would be better to explicitly handle `IllegalAccessException` and transform it into a `RuntimeException`, and let everything else just propagate out untouched, e.g. no handlers for `RuntimeException` or `Throwable`. ------------- PR Review: https://git.openjdk.org/jdk/pull/24527#pullrequestreview-2762068601 PR Review Comment: https://git.openjdk.org/jdk/pull/24527#discussion_r2040574823