JDK-8266743 : Crash on macOS 10.11 due to ignored @available 10.12 check
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: openjfx17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2021-05-07
  • Updated: 2021-07-08
  • Resolved: 2021-07-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx17Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Since https://bugs.openjdk.java.net/browse/JDK-8265031 the minimum mac-os version for JavaFX is increased to 10.12. We pass that minimum version to the compiler.

With  https://bugs.openjdk.java.net/browse/JDK-8263169 a test is added to check if we are at MacOS 10.12 or above, and if so some code is executed that was not available before 10.12:

 if (@available(macOS 10.12, *)) {...}

The combination of these 2 patches lead to a crash on 10.11 for any JavaFX application. The compiler seems to ignore the `@available` check if we already pass 10.12 as the minimum version, hence the code that wasn't available on 10.11 is tried to be executed.

There are a number of other ways to check if we're at 10.12 at runtime, which would prevent this crash.
Comments
Because we expect some users of JavaFX 17 to run with JDK 16 (or possibly earlier), and a subset of them might have very old Mac hardware, we will choose option #3 for JavaFX 17, and revert the change to the minimum version of macOS for x64 platforms, which was done as part of JDK-8265031, and go back to a minimum of 10.10. I will file a pair of follow-on bugs for JavaFX 18. One to implement option #1 and fail fast if the platform is below the minimum, and a second to bump the minimum macOS version for x64 platforms to 10.12 again. These two bugs could be done separately or at the same time.
07-07-2021

Changeset: 6fe427f9 Author: Kevin Rushforth <kcr@openjdk.org> Date: 2021-07-07 12:31:07 +0000 URL: https://git.openjdk.java.net/jfx/commit/6fe427f9a20aace1466530bd0029af9f7ff7329a
07-07-2021

I filed two follow-on bugs that are targeted for JavaFX 18: 1. JDK-8269967: JavaFX should fail fast on macOS below minimum version 2. JDK-8269968: [REDO] Bump minimum version of macOS for x64 to 10.12 They should be done in that order or at the same time.
06-07-2021

Option 2 (do nothing) is rejected. So we will either do option 1 (fail fast if macOS version is below minimum) or option 3 (revert the minimum macOS version to 10.10 for x64 systems).
01-07-2021

The point of specifying the minimum macOS version for deployment is to be able to use APIs that are provided by that version of the SDK without checking whether they are available. I find it surprising is that earlier versions of macOS will even attempt to load such a binary. So I don't think the solution is to adopt a different runtime check for 10.12 at the point of failure (and even if we did in this case, now that the minimum version is 10.12 it would be easy for another such problem to creep in). Instead I recommend one of three things: 1. Check the macOS version during toolkit initialization and "fail fast" with a reasonable error message if it is lower than the specified minimum (basically this is doing Apple's job for them). 2. Do nothing and let failures happen where they may (this is already what would likely happen in a different spot if someone were to try run any recent version of JavaFX with macOS 10.9). 3. Revert the fix that bumped the minimum version on x64 platforms to 10.12 and go back to a minimum of 10.10 Option 1 would be my first choice. macOS 10.11 is so far out of support that I am a bit surprised anyone is still using it. Worth noting is that JDK 17 set their minimum to 10.12, which means that older versions are unlikely to work with JDK 17 as well. Option 3 would be my second choice. I would expect many users to run JavaFX 17 with JDK 16, so doing option 3 would mean they could still run (unsupported, of course) on macOS 10.10 or 10.11.
07-05-2021