RFR: 8267505: {List, Set, Map}PropertyBase::bind should check against identity

Marius Hanl github.com+66004280+maran23 at openjdk.java.net
Sat May 29 00:26:15 UTC 2021


On Mon, 24 May 2021 11:56:35 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> ListPropertyBase::bind, SetPropertyBase::bind, MapPropertyBase::bind have a check on whether a different instance of the observable is the same, and this PR changes that to check against identity.
> 
> Tests are included.

Looks good. Verified tests failing before and succeed after the fix.

One side note which might explaing, why equals was used: The super class `ReadOnlyList/Set/MapProperty` have hashcode/equals overridden, where equals accepts the corresponding collection (List/Set/Map), which is then checked against the collection the property has set. 

This is fine, although it looks a bit weird at first as the equals expects a collection, not a property. But it makes sense as all those classes implements the corresponding collection interface (List/Map/Set).

And a quick look in the history is showing, that at first the equals was really checking for a property (and in there: bean and name), which makes `normalList.equals(listProperty)` never work. So maybe this is leftover code from the old implementaation.

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

Marked as reviewed by Maran23 at github.com (no known OpenJDK username).

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


More information about the openjfx-dev mailing list