RFR: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value

Stuart Marks smarks at openjdk.org
Tue Jun 6 00:23:04 UTC 2023


On Fri, 2 Jun 2023 01:12:32 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null.

Thanks for looking at this.

Yeah, the serializability of various Entry objects that are exposed through the APIs is all over the map, so to speak. Note that entries obtained from the entrySet() of HashMap and TreeMap are _not_ serializable. These are actual internal nodes of the respective Map implementations. But TreeMap uses AbstractMap.SimpleImmutableEntry in several places to disconnect the returned entry from the map, and that class is serializable. Oh well. (And yes that code dated back to the beginning of the available OpenJDK history, which puts it at JDK 1.6 or at least certainly before 7.)

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

PR Comment: https://git.openjdk.org/jdk/pull/14278#issuecomment-1577719707


More information about the core-libs-dev mailing list