Skip to content

Commit

Permalink
8330815: Use pattern matching for instanceof in KeepAliveCache
Browse files Browse the repository at this point in the history
Reviewed-by: jpai, djelinski
  • Loading branch information
RealCLanger committed Apr 25, 2024
1 parent d43654e commit e818ab6
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 e818ab6

@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 jdk22u

@openjdk
Copy link

@openjdk openjdk bot commented on e818ab6 May 1, 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-e818ab60 in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u: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 e818ab60 from the openjdk/jdk repository.

The commit being backported was authored by Christoph Langer on 25 Apr 2024 and was reviewed by Jaikiran Pai and Daniel Jeliński.

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/jdk22u:

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

Please sign in to comment.