RFR: 8319669: [macos14] Running any JavaFX app prints Secure coding warning [v2]

Kevin Rushforth kcr at openjdk.org
Wed Nov 8 19:43:24 UTC 2023


> Fix [JDK-8319669](https://bugs.openjdk.org/browse/JDK-8319669) as follows:
> 
> 1. Override the `NSApplicationDelegate` method `applicationSupportsSecureRestorableState` in `GlassApplication` and return `YES`. This silences the warning that FX applications now get on macOS 14.
> 2. Create and initialize an `NSApplicationFX` subclass of `NSApplication` with no additional functionality. This stops AWT from overwriting the NSApplicationDelegate (`GlassApplication`) that JavaFX sets during toolkit initialization in the case where the AWT toolkit is used from a JavaFX Application (e.g., when using SwingNode or other Swing functionality), and is necessary in order to safely do the above. It also fixes other problems that can result from the delegate being overwritten.
> 
> As noted in the bug report, this PR solves the following problems:
> 
> * Eliminates the "Secure coding is not enabled for restorable state" warning on macOS 14
> * The assertion error reported in [JDK-8318129](https://bugs.openjdk.org/browse/JDK-8318129)
> 
> * The FX application stops getting messages when the application is hidden, deactivated, reactivated, etc. We currently don't do anything with these messages once the application is running, but we might do so in the future.
> 
> * Probably related to the above, we sometimes get an odd behavior when trying to hide an application on macOS 13 using the CMD-H key after the AWT Toolkit has been initialized. Instead of hiding the window, it pops up a finder window with a folder icon and a label that shows the version of Java.
> 
> * If AWT and FX return a different answer from their delegate's `applicationSupportsSecureRestorableState` method, it will crash on macOS 13.x.
> 
> This is the FX equivalent of [JDK-8318854](https://bugs.openjdk.org/browse/JDK-8318854) in AWT.

Kevin Rushforth has updated the pull request incrementally with one additional commit since the last revision:

  Fix typo: remove redundant `isEmbedded =` assignement

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/1280/files
  - new: https://git.openjdk.org/jfx/pull/1280/files/ef998928..4a79cb29

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1280&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1280&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/1280.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1280/head:pull/1280

PR: https://git.openjdk.org/jfx/pull/1280


More information about the openjfx-dev mailing list