On Wed, 19 Jan 2022 02:22:33 GMT, Roger Riggs <[email protected]> wrote:

>> Joe Darcy has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Respond to review feedback.
>
> src/java.base/share/classes/java/util/Objects.java line 170:
> 
>> 168:      * {@return a string equivalent to the string returned by {@code
>> 169:      * Object.toString} if that method is not overridden}
>> 170:      *
> 
> The original Object.toString() invokes the hashCode() method.
> Perhaps the spec should indicate that it calls IdentityhashCode() instead of 
> hashCode().
> 
> Though not incorrect, in Valhalla, Not all objects have identity and will 
> need to different implementation.
> 
> Are there any use cases in the JDK that will use this method?

I updated the return statement to say if hashCode isn't overridden either. The 
implSpec tag does explicitly mention identityHashCode already.

There are a few instances of this sort of code in the JDK src directory 
already; I may include a refactoring of at least one of them in a future 
revision of the PR. Thanks.

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

PR: https://git.openjdk.java.net/jdk/pull/7139

Reply via email to