On Tue, 25 Aug 2026 21:35:17 GMT, Stuart Marks <[email protected]> wrote:

>> Bill Huang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Implement review comment
>
> test/jdk/java/util/HashMap/PutNullKey.java line 114:
> 
>> 112:         @Override
>> 113:         public int compareTo(CollidingHashValue o) {
>> 114:             return value - o.value;
> 
> Use `Integer.compare` here. Subtraction won't fail given the int values used 
> here, but somebody might change it to use random ints.
> 
> Oh... I see you copied from the code above that does the same thing (and same 
> for equals). Is there some way to avoid this duplication?

@AsValueClass isn't really about making one class permanently dual-mode — it's 
just a stand-in for syntax we can't use yet without preview. Once value class 
actually ships, CollidingHashValue just becomes a real value class, no more 
toggle, and CollidingHash stays a real identity class like it always was. 
They're not two versions of the same thing that could eventually merge — 
they're the two classes we'll actually need long-term, we're just spelling one 
of them with @AsValueClass for now instead of value class.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32201#discussion_r3882499072

Reply via email to