RFR: 8356605: JRSUIControl.hashCode and JRSUIState.hashCode can use Long.hashCode
Shaojin Wen
swen at openjdk.org
Mon May 12 23:13:55 UTC 2025
On Mon, 12 May 2025 22:50:34 GMT, Phil Race <prr at openjdk.org> wrote:
> I'm not entirely convinced this "simplification" was worth anyone's time to understand and review. I've run tests and I don't see any failures, but it wasn't likely something we have a test for. You'll need to fix the PR name
@pprace, thank you for reviewing this PR. I will follow your advice and will not submit similar PRs in the client module.
> src/java.desktop/macosx/classes/apple/laf/JRSUIState.java line 186:
>
>> 184: @Override
>> 185: public int hashCode() {
>> 186: return super.hashCode() ^ Double.hashCode(value);
>
> Since this uses Double.hashCode() not Long.hashCode() it would have been nice to have some comments on that. It took a bit of reading and following to learn that Double.hashCode() first uses Double.doubleToRawLongBits and then calls out to Long.hashCode
Double.hashCode is a simple call, and there are no comments in other places where Double.hashCode is used in the JDK source code.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24989#issuecomment-2874418460
PR Review Comment: https://git.openjdk.org/jdk/pull/24989#discussion_r2085653994
More information about the client-libs-dev
mailing list