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

Select binding not updated correctly in JavaFX 19-ea+9

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • jfx19
    • javafx
    • Tested on macOS 12.4 but probably not relevant.

    • generic
    • generic

      Some change between JavaFX 19-ea+8 and 19-ea+9 has completely
      broken my application. Where I previously had my map display
      there is now just a big white hole without any error message.

      I tracked this down to a problem with select bindings. I cannot
      provide a fully working demo here because it is not yet clear to me
      what actually triggers this behaviour but the observation is this:

      Assume an implementation for the following code fragment.

      public interface MapContext {

      [...]

      ReadOnlyObjectProperty<Projection> projectionProperty();

      [...]

      }

      protected final ObjectProperty<MapContext> mc = new SimpleObjectProperty<>(this, "mapContext", null);

      protected final ObjectBinding<Projection> projection = Bindings.select(mc, "projection");

      var mcNotNull = mc.get() != null;
      var projNotNull1 = projection.get() != null;
      var projNotNull2 = mcNotNull && mc.get().projectionProperty().get() != null;

      The MapContext is a complex structure with many properties which get updated frequently.
      "mc" is holding the current instance of this structure. I now have many select bindings
      which extract parts of this large structure like the "projection" in the example. What
      I observe now is that under certain conditions (which I not yet fully understand) the
      binding does not get updated when some conent of "mc" is changed. The result is that the
      boolean expressions "projNotNull1" and "projNotNull2" will show different results.
      In my case projNotNull1 == false although projNotNull2 evaluates to true.
      So this shows that the binding has just not been updated.
      This code worked flawless for the past few years but is now broken in 19-ea+9.

            jhendrikx John Hendrikx
            mpaus Michael Paus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: