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

JavaFX: WARNING: A terminally deprecated method in sun.misc.Unsafe has been called

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • jfx24
    • jfx24
    • javafx

      To reproduce this, use JDK 24 to run any JavaFX application that renders a control or a complex shape, for example, HelloButton (in rt/appls/toys/Hello). You will get the following warning

      WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
      WARNING: sun.misc.Unsafe::allocateMemory has been called by com.sun.marlin.OffHeapArray (file:.../sdk/lib/javafx.graphics.jar)
      WARNING: Please consider reporting this to the maintainers of class com.sun.marlin.OffHeapArray
      WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release

      As described in JDK-8334137, the Marlin rasterizer uses sun.misc.Unsafe to allocate off-heap memory. JEP 471 [1] deprecated for removal all of the memory-access methods in sun.misc.Unsafe as of JDK 23.

      JEP 498 [2] prints a warning on use of any memory-access methods in sun.misc.Unsafe in JDK 24. This warning can be disabled by "--sun-misc-unsafe-memory-access=allow" in JDK 24. We *must* eliminate our use of sun.misc.Unsafe by fixing JDK-8334137 as soon as possible -- ideally in JavaFX 24 and no later than JavaFX 25.

      In the mean time, we will use this bug to inform application developers that they can run java with the following flag to avoid the warning:

      java --sun-misc-unsafe-memory-access=allow

      [1] https://openjdk.org/jeps/471
      [2] https://openjdk.org/jeps/498

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: