RFR: 8353845: com.sun.javafx.css.BitSet.equals(null) throws NPE [v2]

Andy Goryachev angorya at openjdk.org
Wed Apr 9 14:39:39 UTC 2025


On Wed, 9 Apr 2025 09:07:40 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Fixes the bug that `BitSet.equals(null)` throws NPE.
>> 
>> A single reviewer should be sufficient.
>
> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
> 
>   obj == null

there seems to be some discussion, so let's have 2 reviewers, just to be safe.

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

> 535:         }
> 536: 
> 537:         if (obj == null) {

minor suggestion:

if (obj == this) {
     return true;
} else if (obj == null) {

modules/javafx.graphics/src/shims/java/com/sun/javafx/css/BitSetShim.java line 189:

> 187:     }
> 188: 
> 189:     public boolean equals(Object other) {

This line generates 2 warnings in Eclipse:


Description	Resource	Type	Path	Location
The method equals(Object) of type BitSetShim<T> should be tagged with @Override since it actually overrides a superclass method	BitSetShim.java	Java Problem	/graphics/src/shims/java/com/sun/javafx/css	line 189
The type BitSetShim<T> should also implement hashCode() since it overrides Object.equals()	BitSetShim.java	Java Problem	/graphics/src/shims/java/com/sun/javafx/css	line 39


could you please enable corresponding warnings in your IDE?

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

PR Comment: https://git.openjdk.org/jfx/pull/1766#issuecomment-2789953586
PR Review Comment: https://git.openjdk.org/jfx/pull/1766#discussion_r2035522678
PR Review Comment: https://git.openjdk.org/jfx/pull/1766#discussion_r2035519039


More information about the openjfx-dev mailing list