On Wed, 7 May 2025 11:54:09 GMT, David Beaumont <d...@openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Reformat
>>  - Revert changes in public classes
>
> test/jdk/java/lang/StableValue/StableFieldUpdaterExampleTest.java line 117:
> 
>> 115:         private static final ToIntFunction<LazyFoo> HASH_UPDATER =
>> 116:                 StableFieldUpdater.ofInt(LazyFoo.class, "hash",
>> 117:                         l -> Objects.hash(l.bar, l.baz), -1);
> 
> As someone unfamiliar with this, I'm given to ask "What's the -1 for?"
> 
> I *think* I can intuit that it's a value to be used *if* the hashcode 
> actually ends up calculating zero (so any random bit pattern would (should?) 
> be equally useful?
> 
> In example code if feels like this is not quite explaining itself enough to 
> teach someone about its usage. For example (if it's what I think) it can't 
> actually be passed as zero.

I've added some verbiage around this now. Let me know if it can be improved 
further.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25040#discussion_r2077688537

Reply via email to