RFR: 8353845: com.sun.javafx.css.BitSet.equals(null) throws NPE
Nir Lisker
nlisker at openjdk.org
Wed Apr 9 09:01:48 UTC 2025
On Wed, 9 Apr 2025 07:06:29 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
> Fixes the bug that `BitSet.equals(null)` throws NPE.
>
> A single reviewer should be sufficient.
modules/javafx.graphics/src/main/java/com/sun/javafx/css/BitSet.java line 536:
> 534: return true;
> 535: }
> 536: if (obj != null && getClass() == obj.getClass()) { // fast path if other is exact same type of BitSet
Isn't it easier to return `false` on `null`?
modules/javafx.graphics/src/test/java/test/com/sun/javafx/css/BitSetTest.java line 50:
> 48: @Test
> 49: void equalsNullShouldBeFalse() {
> 50: assertFalse(set.equals(null));
Isn't `assertNotEquals` more suitable here?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1766#discussion_r2034838251
PR Review Comment: https://git.openjdk.org/jfx/pull/1766#discussion_r2034839573
More information about the openjfx-dev
mailing list