setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE) - compiles but fails
An application, developed with Java 5, shows a small JDialog before the main application JFrame is launched.
If the user closes the dialog, the application is terminated.
To obtain this behavior, the default close operation is set to EXIT_ON_CLOSE. Although the API doesn't mention this as a valid option, the field is inherited from the javax.swing.WindowConstants class and it works just fine on the Java 5 platform.
I tried to migrate the application to Java 6. The field is still inherited (of course), the source compiles without errors but when the application is launched, following error is displayed:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE
Seems logic to me since apparently that option shouldn't be used for a JDialog, but it's hard to migrate an application if source compliancy gives no guarantees on runtime compliancy.