<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 <chen.l.liang@oracle.com> 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>
<div id="appendonsend"></div>
<hr tabindex="-1" style="display:inline-block;width:98%">
<div dir="ltr" id="divRplyFwdMsg"><font color="#000000" style="font-size:11pt" face="Calibri, sans-serif"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Naoto Sato <naoto.sato@oracle.com><br>
<b>Sent:</b> Wednesday, April 30, 2025 3:11 PM<br>
<b>To:</b> core-libs-dev@openjdk.org <core-libs-dev@openjdk.org><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 <core-libs-dev-retn@openjdk.org> on behalf of <br>
> Joseph D. Darcy <joe.darcy@oracle.com><br>
> *Sent:* Wednesday, April 30, 2025 2:54 PM<br>
> *To:* Steffen Nießing <zuniquex@protonmail.com>; core-libs- <br>
> dev@openjdk.org <core-libs-dev@openjdk.org><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">
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">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>