RFR: JDK-8304933: BitSet (used for CSS pseudo class states) listener management is incorrect

Kevin Rushforth kcr at openjdk.org
Mon Apr 10 21:07:52 UTC 2023


On Mon, 3 Apr 2023 06:29:58 GMT, Michael Strauß <mstrauss at 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 617:
> 
>> 615:     @Override
>> 616:     public void removeListener(InvalidationListener invalidationListener) {
>> 617:         if (invalidationListener != null) {
> 
> `Observable.removeListener(InvalidationListener)` is specified to reject `null` by throwing NPE.

As with the earlier comment, any changes to the behavior of a null listener should be done separately and not part of this PR.

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

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


More information about the openjfx-dev mailing list