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

Cannot compile FXDnD with JDK 9: DropTargetContext::addNotify, removeNotify not found

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 9
    • 9
    • javafx
    • None

      As a result of the fix for JDK-8074763 we can no longer compile FX 9-dev using JDK 9 as the boot JDK. We currently use JDK 8u40 as our boot JDK, so our production builds are not affected. However, Swing / FX drag and drop will likely fail at runtime with a NoSuchMethodError as a result of this.

      Here is the error:

      $ java -version
      java version "1.9.0-ea"
      Java(TM) SE Runtime Environment (build 1.9.0-ea-b77)
      Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b77, mixed mode)

      $ gradle
      ...
      :swing:compileJava/localhome/kcr/javafx/9-kcr/jfx/rt/modules/swing/src/main/java/javafx/embed/swing/FXDnD.java:480: error: cannot find symbol
                          if (ctx != null) ctx.removeNotify();
                                              ^
        symbol: method removeNotify()
        location: variable ctx of type DropTargetContext
      /localhome/kcr/javafx/9-kcr/jfx/rt/modules/swing/src/main/java/javafx/embed/swing/FXDnD.java:489: error: cannot find symbol
                              ctx.addNotify(FXDropTargetContextPeer.this);
                                 ^
        symbol: method addNotify(FXDnD.FXDropTargetContextPeer)
        location: variable ctx of type DropTargetContext
      /localhome/kcr/javafx/9-kcr/jfx/rt/modules/swing/src/main/java/javafx/embed/swing/FXDnD.java:511: error: cannot find symbol
                          if (ctx != null) ctx.removeNotify();
                                              ^
        symbol: method removeNotify()
        location: variable ctx of type DropTargetContext
      /localhome/kcr/javafx/9-kcr/jfx/rt/modules/swing/src/main/java/javafx/embed/swing/FXDnD.java:520: error: cannot find symbol
                          if (ctx != null) ctx.removeNotify();
                                              ^
        symbol: method removeNotify()
        location: variable ctx of type DropTargetContext
      Note: Some input files use or override a deprecated API.
      Note: Recompile with -Xlint:deprecation for details.
      Note: Some input files use unchecked or unsafe operations.
      Note: Recompile with -Xlint:unchecked for details.
      4 errors
       FAILED

      FAILURE: Build failed with an exception.

      * What went wrong:
      Execution failed for task ':swing:compileJava'.
      > Compilation failed with exit code 1; see the compiler error output for details
      .

      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug
      option to get more log output.

      BUILD FAILED

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

              Created:
              Updated:
              Resolved: