I am using Java Beans with
firePropertyChange(String propertyName, Object oldValue,
Object newValue)
to propagate data updates to my Swing GUI.
It works with every other value, but when newValue is null, no event is sent. Any way to fix this?
Practically, the property change does not fire if the following predicate holds:
so your result is not unexpected. Conceptually, it makes sense to minimize spurious updates, but also to distinguish between a property that was never set and one that has become
null, perhaps inadvertently. Without more context, it’s difficult to propose an alternative, but you might use a sentinel value to signify a value that has becomenullintentionally.