RFR: 8274771: Map, FlatMap and OrElse fluent bindings for ObservableValue [v3]
Nir Lisker
nlisker at openjdk.java.net
Wed Jan 5 13:07:12 UTC 2022
On Wed, 5 Jan 2022 09:52:29 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> modules/javafx.base/src/main/java/javafx/beans/binding/ObjectBinding.java line 204:
>>
>>> 202: *
>>> 203: * @return {@code true} if this binding is allowed to become valid, otherwise
>>> 204: * {@code false}
>>
>> Typo: overriden -> overridden
>>
>> I would add a a first-sentence summary and an explanation as to why a binding would not allow it. I would write something like
>>
>> Checks if the binding is allowed to become valid. Overriding classes can prevent a binding from becoming
>> valid. This is useful when ____.
>> <p>
>> The default implementation always allows bindings to become valid.
>
> I've made your suggested changes and added this explanation: "This is useful in subclasses which do not always listen for invalidations of their dependencies and prefer to recompute the current value instead. This can also be useful if caching of the current computed value is not desirable."
>
> Furthermore, I noticed I forgot to make the code changes that prevent caching of the value when the binding is invalid -- bindings currently cache their value even when invalid, which could lead to situations where something is still being referenced in an invalid binding that should have been GC'd.
Something like that was previously discussed in https://github.com/javafxports/openjdk-jfx/pull/110.
-------------
PR: https://git.openjdk.java.net/jfx/pull/675
More information about the openjfx-dev
mailing list