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:49 UTC 2023


On Mon, 3 Apr 2023 07:23:28 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> 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`.
>
> I could remove these checks in this PR, or as part of the larger `BitSet` clean-up PR.   The extra check doesn't break anything though, while this PR is mainly focused on fixing a long standing bug that everyone dealing with `ObservableSet<PseudoClass>` can encounter currently.

I do not recommend making any changes to how null is treated as part of this PR. This PR, as it stands, is a simple bug fix, so this sort of change seems out of scope.

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

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


More information about the openjfx-dev mailing list