Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
/ jdk22u Public archive

Commit

Permalink
8330815: Use pattern matching for instanceof in KeepAliveCache
Browse files Browse the repository at this point in the history
Backport-of: e818ab60a0c1dac277b8b15301cdfb7d439ed26c
  • Loading branch information
RealCLanger committed May 7, 2024
1 parent e4a1a7b commit 0ec3c0b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -389,9 +389,9 @@ public KeepAliveKey(URL url, Object obj) {
*/
@Override
public boolean equals(Object obj) {
if ((obj instanceof KeepAliveKey) == false)
if (!(obj instanceof KeepAliveKey kae))
return false;
KeepAliveKey kae = (KeepAliveKey)obj;

return host.equals(kae.host)
&& (port == kae.port)
&& protocol.equals(kae.protocol)
Expand All @@ -405,7 +405,7 @@ public boolean equals(Object obj) {
@Override
public int hashCode() {
String str = protocol+host+port;
return this.obj == null? str.hashCode() :
return this.obj == null ? str.hashCode() :
str.hashCode() + this.obj.hashCode();
}
}
Expand Down

3 comments on commit 0ec3c0b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 0ec3c0b May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger the backport was successfully created on the branch backport-RealCLanger-0ec3c0b1 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 0ec3c0b1 from the openjdk/jdk22u repository.

The commit being backported was authored by Christoph Langer on 7 May 2024 and had no reviewers.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-RealCLanger-0ec3c0b1:backport-RealCLanger-0ec3c0b1
$ git checkout backport-RealCLanger-0ec3c0b1
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-RealCLanger-0ec3c0b1

Please sign in to comment.