On Tue, 24 Mar 2026 17:22:40 GMT, Alexey Ivanov <[email protected]> wrote:
>> test/jdk/javax/swing/RepaintManager/RemoveInvalidComponentTest.java line 76:
>>
>>> 74:
>>> 75: JFrame frame = new JFrame("RemoveInvalidComponentTest");
>>> 76: frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
>>
>> This line is not needed?
>
> Unless you comment out `frame.dispose()` to view how the frame looks.
> Otherwise, the frame will not close and the test will never exit.
>
> It's common for tests to provide a default close operation,
> `DISPOSE_ON_CLOSE` is the safest option.
It looks like most of the DISPOSE_ON_CLOSE usages in tests were added recently.
It is better not to use it since in some cases it allows bypassing the test
logic and make the test green. I also recall that at some point several tests
were cleaned up to remove it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30184#discussion_r2984414029