RFR: 8288628: Unnecessary Hashtable usage in ConditionalSpecialCasing

Jaikiran Pai jpai at openjdk.org
Sat Jun 18 07:28:53 UTC 2022


On Wed, 15 Jun 2022 19:49:52 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> If a thread-safe implementation is not needed, it is recommended to use HashMap in place of Hashtable.
> `ConditionalSpecialCasing.entryTable` is read-only Map which is modified only in `static` block. It means we can safely replace it with HashMap.

Changing this to `HashMap` now means that usages of this might have to check for `null` values returned by the `Map` APIs. Looking at the usage of `entryTable`, it appears that there are relevant `null` checks already in place, plus I don't see any code in this class which directly returns the values from the `entryTable` to callers of this class.

So the change looks fine to me.

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

Marked as reviewed by jpai (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9172


More information about the core-libs-dev mailing list