Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8277962

Deprecate JavaFX GTK 2 library for removal

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • jfx18
    • javafx
    • None
    • behavioral
    • minimal
    • The only change in behavior is that a warning message is logged if the GTK 2 library is selected.
    • System or security property, Other
    • JDK

      Summary

      The JavaFX GTK 2 library is deprecated for removal. A warning message to that effect is now printed when the GTK 2 library is loaded.

      Problem

      On Linux, JavaFX uses the GTK 3 library by default. It will fallback to the GTK 2 library in some cases. Further, the GTK 2 library can be requested by setting the system property, jdk.gtk.version to 2 (e.g., -Djdk.gtk.version=2)

      With the announcement of the GTK 4 release in December 2020, the GTK 2 toolkit has reached its end of life.

      https://blog.gtk.org/2020/12/16/gtk-4-0/

      Newer Linux distros have already stopped shipping the GTK 2 libraries by default, and we expect that they will soon stop shipping them entirely.

      Continuing to support the GTK 2 library in JavaFX creates a maintenance burden that could be eliminated by removing the implementation for that library.

      Solution

      Deprecate the JavaFX glass GTK 2 library for removal. Since there isn't an associated API, the mechanism for doing this is to print a "deprecated for removal" warning message when the glassgtk2 library it is loaded. A message is printed regardless of why the GTK 2 library was loaded, which can happen for one of the following reasons:

      1. The application or end user has explicitly requested GTK 2 using the jdk.gtk.version system property.
      2. Another native library has already loaded the GTK 2 library (an application cannot load both the GTK 2 and GTK 3 libraries in the same process)
      3. As a fallback if the gtk3 libraries are not available on the system.

      We will add a release note for this change.

      Specification

      If the JavaFX GTK 2 library is used, one of the following three messages will be printed to System.err depending on the reason GTK 2 is used.

      Case 1: The application or end user has explicitly requested GTK 2 using the jdk.gtk.version system property.

      WARNING: A command line option has enabled the GTK 2 library
      WARNING: The JavaFX GTK 2 library is deprecated and will be removed in a future release

      Case 2: Another native library has already loaded the GTK 2 library (an application cannot load both the GTK 2 and GTK 3 libraries in the same process).

      WARNING: Found GTK 2 library already loaded
      WARNING: The JavaFX GTK 2 library is deprecated and will be removed in a future release

      Case 3: As a fallback if the gtk3 libraries are not available on the system.

      WARNING: Using GTK 2 library because GTK 3 cannot be loaded
      WARNING: The JavaFX GTK 2 library is deprecated and will be removed in a future release

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Johan Vos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: