On Wed, 9 Dec 2020 13:59:09 GMT, Thomas Schatzl <tscha...@openjdk.org> wrote:
>> test/jdk/java/lang/ref/ReferenceEnqueue.java line 58: >> >>> 56: for (int i = 0; i < iterations; i++) { >>> 57: System.gc(); >>> 58: enqueued = (queue.remove(100) == ref); >> >> The code does not catch `InterruptedException` like it does in the other >> files. > > I understand that the test code previously just forwarded the > `InterruptedException` if it happened in the `Thread.sleep()` call too. So > this may only be an exiting issue and please ignore this comment. > Not catching `InterruptedException` here only seems to be a cause for > unnecessary failure. Then again, it probably does not happen a lot. Nothing in the test calls Thread.interrupt(), so there isn't a risk of failure due to not handling that exception in some "interesting" way. But InterruptedException must be "handled" somehow, because it's a checked exception. That's already dealt with by the run() method declaring that it throws that type, and main declaring that it throws Exception. The other tests modified in this change don't take that approach (just let it propagate out through main), instead wrapping the interruptable calls in try/catch, though again just to satisfy the requirement that a checked exception must be statically verified to be handled, even though there aren't going to be any thrown. ------------- PR: https://git.openjdk.java.net/jdk/pull/1691