On Wed, 11 Mar 2026 14:32:09 GMT, Shaojin Wen <[email protected]> wrote:
> FloatEntryImpl.equals() and DoubleEntryImpl.equals() used == for comparison, > which returns false for NaN == NaN per IEEE 754. This caused two different > FloatEntry/DoubleEntry objects holding NaN to not be considered equal, > violating the equals/hashCode contract (same hashCode but equals returns > false). > > Similarly, SplitConstantPool.findFloatEntry() and findDoubleEntry() used == > to match values, so NaN entries could never be found in the pool, causing > every floatEntry(Float.NaN) or doubleEntry(Double.NaN) call to create a > duplicate entry and bloat the constant pool. > > Fix by using Float.floatToRawIntBits() and Double.doubleToRawLongBits() for > bitwise comparison, which correctly handles NaN and also properly > distinguishes +0.0 from -0.0. > > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/30196
