Indeed, Archie is right. There are different levels of strictness in the 
specification.

In this particular site, we have "the hash code is the value of the expression" 
which only requires the return value to be equivalent. The implementation is 
free to be anything.

In specifications, we usually use "equivalent" to indicate behaviors are the 
same but implementation code may differ. The words "the same as", "idential to" 
or simply "is" indicate exact matches.

-Chen
________________________________
From: core-libs-dev <core-libs-dev-r...@openjdk.org> on behalf of Archie Cobbs 
<archie.co...@gmail.com>
Sent: Wednesday, April 30, 2025 3:43 PM
To: Steffen Nießing <zuniq...@protonmail.com>
Cc: core-libs-dev@openjdk.org <core-libs-dev@openjdk.org>
Subject: Re: JavaDoc fix in java.util.Date

On Wed, Apr 30, 2025 at 3:38 PM Steffen Nießing 
<zuniq...@protonmail.com<mailto:zuniq...@protonmail.com>> wrote:
However, the docs should match the expression used in the implementation when 
explicitly naming the returned expression. Should we update both to 
Long.hashCode(this.getTime())?

I think that's a little too strong of a statement. Rather, if the docs describe 
the behavior using an expression or sample code, the actual behavior should be 
equivalent to that expression or sample code; the actual implementation can 
effect that result however it wants to, as long as the result is the same.

-Archie

--
Archie L. Cobbs

Reply via email to