RFR: 8366238: Improve RBTree API with stricter comparator semantics and pluggable validation/printing hooks. [v3]

Casper Norrbin cnorrbin at openjdk.org
Mon Sep 1 13:40:29 UTC 2025


On Mon, 1 Sep 2025 09:12:49 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> src/hotspot/share/utilities/rbTree.hpp line 65:
>> 
>>> 63: // Nodes are address stable and will not change during its lifetime.
>>> 64: 
>>> 65: enum class RBTreeOrdering : int { less = -1, equal = 0, greater = 1 };
>> 
>> Is assigning the elements to specific values necessary?
>
> Personally, I'd prefer LT, EQ, GT to be the enum members. I'd like to see a `TotalOrdering` enum class in the future, to replace this.

I assigned the values so they'd be similar to the previous `int` return, not really needed.
I don't mind the other names, so renamed to LT, EQ, GT and removed the values.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26981#discussion_r2313986169


More information about the hotspot-dev mailing list