RFR: 8290310: ChangeListener events are incorrect or misleading when a nested change occurs

John Hendrikx jhendrikx at openjdk.org
Sun Jul 17 21:06:17 UTC 2022


On Sun, 17 Jul 2022 20:59:46 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> This contains the following:
> - Nested changes or invalidations using ExpressionHelper are delayed until the current emission completes
>   - This fixes odd change events being produced (with incorrect oldValue)
>   - Also fixes a bug in ExpressionHelper where a nested change would unlock the listener list early, which could cause a `ConcurrentModificationException` if a nested change was combined with a remove/add listener call
> - A test for ExpressionHelper to verify the new behavior
> - A test for all *Property and *Binding classes that verifies correct listener behavior at the API level (this tests gets 85% coverage on ExpressionHelper on its own, the only thing it is not testing is the locking behavior, which is not relevant at the API level).
> - A fix for `WebColorFieldSkin` which triggered a nested change which used a flag to prevent an event loop (I've changed it now to match how `DoubleFieldSkin` and `IntegerFieldSkin` do it

modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/WebColorFieldSkin.java line 116:

> 114:                 }
> 115:             } catch (java.lang.IllegalArgumentException ex) {
> 116:                 System.out.println("Failed to parse ["+text+"]");

Removed this as it's impossible to reach this code, even in a test: `Color.web` can throw this, but since the input is fully verified by pattern, it would be a bug that should be in-your-face instead of sysout.

-------------

PR: https://git.openjdk.org/jfx/pull/837


More information about the openjfx-dev mailing list