Skip to content

Commit

Permalink
8330815: Use pattern matching for instanceof in KeepAliveCache
Browse files Browse the repository at this point in the history
Backport-of: 0ec3c0b1e698f7ad39b4da2edb062721e4670f58
  • Loading branch information
RealCLanger committed May 9, 2024
1 parent 93d091a commit ddecbe5
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 ddecbe5

@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 jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on ddecbe5 May 13, 2024

Choose a reason for hiding this comment

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

@RealCLanger Could not automatically backport ddecbe52 to openjdk/jdk17u-dev due to conflicts in the following files:

  • src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk17u-dev.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b backport-RealCLanger-ddecbe52

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk21u-dev.git ddecbe52018fdb7556b04b20e8529eb430d3aa75

# Backport the commit
$ git cherry-pick --no-commit ddecbe52018fdb7556b04b20e8529eb430d3aa75
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport ddecbe52018fdb7556b04b20e8529eb430d3aa75'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Backport ddecbe52018fdb7556b04b20e8529eb430d3aa75.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ddecbe52 from the openjdk/jdk21u-dev repository.

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

Thanks!

Please sign in to comment.