On Thu, 26 Mar 2026 21:17:37 GMT, Sergey Bylokhov <[email protected]> wrote:

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

Has it ever been a problem? Is it a theoretical concern?

As I said, *“Any interaction while an automatic test is running invalidates the 
test results.”* Irrespective of whether the test fails or not as the result of 
the interaction.

Yet calling `frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)` makes 
visual inspection easier. Therefore, I will never ask for removing 
`DISPOSE_ON_CLOSE` from a test.

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

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

Reply via email to