Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No property change happens when a value is explicitly set to NaN that was undefined before #255

Open
draeger opened this issue Nov 24, 2022 · 0 comments
Labels

Comments

@draeger
Copy link
Member

draeger commented Nov 24, 2022

When listening to changes in a model, the TreeNodeChangeListener is activated when a previously undefined double value is explicitly set to NaN but then nothing happens because we are comparing the old value with the new value using a call to the equals method here. Appearantly, undefined values are NaN behind the scenes. The setValue method still notices the difference and calls the change listeners because there the difference is identified using an != operator (see here).

My suggestion for a fix would be to change the check in AbstractTreeNode so that in addition to !equals also a check via != is performed, i.e.,

else if ((oldValue != null) && (!oldValue.equals(newValue) || oldValue != newValue))

Could such a change have any unwanted effects, too?

@draeger draeger added the bug label Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant