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

Reference to State in Task.java is ambiguous when building with JDK 19

XMLWordPrintable

    • b06

      When using JDK 19 to build JavaFX, we get the following error from the "javadoc" task:

      modules/javafx.graphics/src/main/java/javafx/concurrent/Task.java:693: error: reference to State is ambiguous
          private ObjectProperty<State> state = new SimpleObjectProperty<>(this, "state", State.READY);
                                 ^
        both enum java.util.concurrent.Future.State in Future and enum javafx.concurrent.Worker.State in Worker match
      modules/javafx.graphics/src/main/java/javafx/concurrent/Task.java:694: error: reference to State is ambiguous
          final void setState(State value) { // package access for the Service
                              ^
        both enum java.util.concurrent.Future.State in Future and enum javafx.concurrent.Worker.State in Worker match
      modules/javafx.graphics/src/main/java/javafx/concurrent/Task.java:732: error: reference to State is ambiguous
          @Override public final State getState() { checkThread(); return state.get(); }
                                 ^
        both enum java.util.concurrent.Future.State in Future and enum javafx.concurrent.Worker.State in Worker match
      modules/javafx.graphics/src/main/java/javafx/concurrent/Task.java:733: error: reference to State is ambiguous
          @Override public final ReadOnlyObjectProperty<State> stateProperty() { checkThread(); return state; }
                                                        ^
        both enum java.util.concurrent.Future.State in Future and enum javafx.concurrent.Worker.State in Worker match
      4 errors


      The only reason we don't get them from the javac task is that we run javac with "--release 17" for most modules, including the gaphics modules. If we instead use "-source 17 -target 17" then javac produces the same error.

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: