On Mon, 27 Mar 2023 14:24:42 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

> BitSet uses the SetListenerHelper abstraction to prevent allocating the 
> listener arrays.
> 
> When removing listeners, the newly returned listener helper (which may be 
> different from the one called) is not reassigned. This effectively means that 
> removing the listener does not happen.
> 
> This fix correctly assigns the potentially changed SetListenerHelper instance 
> to BitSet's helper field after listener removal.

modules/javafx.graphics/src/main/java/com/sun/javafx/css/BitSet.java line 603:

> 601:     @Override
> 602:     public void removeListener(SetChangeListener<? super T> 
> setChangeListener) {
> 603:         if (setChangeListener != null) {

Even if not explicitly specified for 
`ObservableSet.removeListener(SetChangeListener)`, implementations generally 
reject `null` arguments by throwing NPE. This is the default behavior of 
`SetListenerHelper`.

modules/javafx.graphics/src/main/java/com/sun/javafx/css/BitSet.java line 617:

> 615:     @Override
> 616:     public void removeListener(InvalidationListener 
> invalidationListener) {
> 617:         if (invalidationListener != null) {

`Observable.removeListener(InvalidationListener)` is specified to reject `null` 
by throwing NPE.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1071#discussion_r1155529474
PR Review Comment: https://git.openjdk.org/jfx/pull/1071#discussion_r1155529800

Reply via email to