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

Brent Christian bchristi at openjdk.org
Fri Apr 11 20:12:25 UTC 2025


On Fri, 11 Apr 2025 02:25:20 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> I disagree. IMO, for a test library, it's an unnecessary burden to make callers catch a checked exception.
>
> Hm. In general, if something blocks interruptibly, it should be declared to throw InterruptedException instead of catching and rethrowing something of another exception type. We should look at the use sites to be sure, but it's generally not an inconvenience for tests to deal with checked exceptions; it's perfectly acceptable for them to declare `throws InterruptedException` or even `throws Exception` and let the framework handle the exception if the test itself doesn't want to.

Thanks, Stuart. I've updated the new method to throw `InterruptedException`, and pass the exception from `InvocationTargetException` on through.

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

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


More information about the core-libs-dev mailing list