RFR: JDK-8303897 ObservableValue's when binding should only invalidate when strictly needed [v2]
John Hendrikx
jhendrikx at openjdk.org
Sun Apr 9 20:51:15 UTC 2023
On Sun, 9 Apr 2023 16:42:10 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix review comments
>
> modules/javafx.base/src/test/java/test/javafx/beans/value/ObservableValueWhenTest.java line 139:
>
>> 137: property.when(condition)
>> 138: .map(x -> { observedMappings.add(x); return x; })
>> 139: .addListener((obs, old, current) -> observedChanges.add(old + " -> " + current));
>
> What do you think about a variant with an invalidation listener?
That's not really useful as there is no way to make such a fluent binding valid again (it would invalidate once, and never become valid). The only way to make it valid would be to assign the result of `map` to a variable, and call `get` on that.
I can however add a test that proves the above :)
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1056#discussion_r1161339438
More information about the openjfx-dev
mailing list