<p dir="ltr">Thanks for all these helpful responses. So I guess there's nothing to do here except we want to integrate the change proposed by Chen to update the expression to use Long.hashCode.</p>
<p dir="ltr">Cheers,<br>
Steffen</p>
<div class="protonmail_quote"><br><br>-------- Ursprüngliche Nachricht --------<br>Am 30.04.25 23:25 schrieb Roger Riggs <roger.riggs@oracle.com>:<br><blockquote class="protonmail_quote"><!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Hi Steffen,<br>
<br>
One other oddity about the shift operators in Java, they only use
the lower 5 bits of the shift distance argument.<br>
<br>
So, <br>
<br>
int x = 1024;<br>
x >>4 == 64; and<br>
x >> 36 == 64;<br>
<br>
It is unusual to specify the algorithm used for hashcodes, though in
some cases backward compatibility has forced them to be specified.<br>
<br>
Regards, Roger<br>
<br>
<br>
<div class="moz-cite-prefix">On 4/30/25 4:37 PM, Steffen Nießing
wrote:<br>
</div>
<blockquote type="cite" cite="mid:t7b4RpplTLhZsSGpQLyv3LP4ixFUcRzjsbrnlUObHpduwo-ktA7pcgS4h3IItImabE6y8uU-H_jDITbZ0qcb_Q4VmlsdXXy4yRPM9QbjNso=@protonmail.com">
<div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Thanks,
haven't seen unsigned right shift before. You're right, it
should be fine to use the unsigned one and hence Long.hashCode
for that.</div>
<div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br>
</div>
<div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">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())?</div>
<div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br>
</div>
<div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Cheers,</div>
<div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Steffen</div>
<div style="font-family: Arial, sans-serif; font-size: 14px;"><br>
</div>
<div class="protonmail_quote"> Chen Liang
<a class="moz-txt-link-rfc2396E" href="mailto:chen.l.liang@oracle.com"><chen.l.liang@oracle.com></a> schrieb am Mittwoch, 30. April
2025 um 22:27:<br>
<blockquote class="protonmail_quote" type="cite">
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Well, the sign has no impact here - the most significant 32
bits duplicated from the original sign bit are immediately
discarded in the subsequent int cast truncation to the least
significant 32 bits. However, how there is such a difference
from before OpenJDK was published is still intriguing.</div>
<hr tabindex="-1" style="display:inline-block;width:98%">
<div dir="ltr" id="divRplyFwdMsg"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
core-libs-dev <a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev-retn@openjdk.org"><core-libs-dev-retn@openjdk.org></a> on
behalf of Naoto Sato <a class="moz-txt-link-rfc2396E" href="mailto:naoto.sato@oracle.com"><naoto.sato@oracle.com></a><br>
<b>Sent:</b> Wednesday, April 30, 2025 3:11 PM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:core-libs-dev@openjdk.org">core-libs-dev@openjdk.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev@openjdk.org"><core-libs-dev@openjdk.org></a><br>
<b>Subject:</b> Re: JavaDoc fix in java.util.Date</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Interestingly, the implementation
of Date.hashCode() does use the signed
<br>
right shift ">>".<br>
<br>
Naoto<br>
<br>
On 4/30/25 1:06 PM, Chen Liang wrote:<br>
> Indeed, Joe is right. Unsigned right shift does
not appear often and is <br>
> equivalent to signed right shift if the sign bit
is 0.<br>
> <br>
> However, this piece of quote can get an upgrade -
it can become <br>
> `Long.hashCode(this.getTime())`.<br>
> <br>
> *<br>
> Chen<br>
> <br>
>
------------------------------------------------------------------------<br>
> *From:* core-libs-dev
<a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev-retn@openjdk.org"><core-libs-dev-retn@openjdk.org></a> on behalf of <br>
> Joseph D. Darcy <a class="moz-txt-link-rfc2396E" href="mailto:joe.darcy@oracle.com"><joe.darcy@oracle.com></a><br>
> *Sent:* Wednesday, April 30, 2025 2:54 PM<br>
> *To:* Steffen Nießing
<a class="moz-txt-link-rfc2396E" href="mailto:zuniquex@protonmail.com"><zuniquex@protonmail.com></a>; core-libs- <br>
> <a class="moz-txt-link-abbreviated" href="mailto:dev@openjdk.org">dev@openjdk.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev@openjdk.org"><core-libs-dev@openjdk.org></a><br>
> *Subject:* Re: JavaDoc fix in java.util.Date<br>
> Unsigned right shift is non-existent?<br>
> <br>
> "The operators << (left shift), >>
(signed right shift), and >>> <br>
> (unsigned right shift) are called the shift
operators. The left-hand <br>
> operand of a shift operator is the value to be
shifted; the right-hand <br>
> operand specifies the shift distance. "<br>
> <br>
> <a href="https://docs.oracle.com/javase/specs/jls/se24/html/jls-15.html#jls-15.19" target="_blank" rel="noreferrer nofollow noopener" moz-do-not-send="true" class="moz-txt-link-freetext">
https://docs.oracle.com/javase/specs/jls/se24/html/jls-15.html#jls-15.19</a>
<br>
> <<a href="https://docs.oracle.com/javase/specs/jls/se24/html/jls-15.html#jls-15.19" target="_blank" rel="noreferrer nofollow noopener" moz-do-not-send="true" class="moz-txt-link-freetext">https://docs.oracle.com/javase/specs/jls/se24/html/jls-15.html#jls-15.19</a>><br>
> <br>
> -Joe<br>
> <br>
> On 4/30/2025 12:46 PM, Steffen Nießing wrote:<br>
>> Hello,<br>
>><br>
>> I'm new to the OpenJDK community and plan to
make my first change.<br>
>><br>
>> I've found a small mistake in the
documentation of <br>
>> java.util.Date#hashCode(). The documentation
provides a Java <br>
>> expression of the returned value, which uses
a non-existent operator <br>
>> '>>>'.<br>
>><br>
>> Now I'm searching for a sponsor for a JBS
issue and the code review. <br>
>> Chen Liang directed me to this mailing list
to ask for sponsoring on <br>
>> this topic.<br>
>><br>
>> Cheers,<br>
>> Steffen<br>
> <br>
> <br>
<br>
</div>
</span></font></div>
</blockquote>
<br>
</div>
</blockquote>
<br>
</body>
</html>
</blockquote></div>