RFR: 8274771: Map, FlatMap and OrElse fluent bindings for ObservableValue [v5]

John Hendrikx jhendrikx at openjdk.java.net
Thu Jan 27 21:20:09 UTC 2022


On Thu, 20 Jan 2022 17:19:49 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 grammar mistakes and did some small rephrases
>
> modules/javafx.base/src/main/java/javafx/beans/value/LazyObjectBinding.java line 91:
> 
>> 89:              *
>> 90:              * As the binding must be valid after it becomes observed the first time
>> 91:              * 'get' is called again.
> 
> Maybe add an `@link` to `ExpressionHelper` where the validation happens before listener registration, for clarity.

I've added this additional text:

             * See com.sun.javafx.binding.ExpressionHelper (which is used
             * by ObjectBinding) where it will do a call to ObservableValue#getValue
             * BEFORE adding the actual listener. This results in ObjectBinding#get
             * to be called in which the #allowValidation call will block it from
             * becoming valid as the condition is "isObserved()"; this is technically
             * correct as the listener wasn't added yet, but means we must call
             * #get again to make this binding valid.

This might be something we can fix in future work, to avoid this double call to `get`.

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

PR: https://git.openjdk.java.net/jfx/pull/675


More information about the openjfx-dev mailing list