On Tue, 24 Mar 2026 21:35:07 GMT, Sergey Bylokhov <[email protected]> wrote:

>> 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.

>@mrserb Can you elaborate how DISPOSE_ON_CLOSE allows bypassing the test logic?

That will dispose the frame, which may affect the test. For example, not all 
listeners may be called, some assertions may be skipped and this is not be 
printed in the logs It is too easy to abuse and is better to skip. The test 
should have one exit point when it passes, and some othere when it fails due to 
assertions, hangs, etc.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30184#discussion_r2997718020

Reply via email to