-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8352171: Arrays.hashCode for sub-range of byte array API addition #24128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back linzihao1999! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@linzihao1999 The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
To me, it seems odd to add only the |
* @since 25 | ||
*/ | ||
public static int hashCode(byte[] a, int fromIndex, int toIndex) { | ||
if (a == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The a == null
special check is dubious - a == null
has a meaning if we are hashing a whole byte[]
object, but with a specific fromIndex
and toIndex
it just doesn't work.
That said, we might consider accepting the initial hash too - For example, we have two byte[]
arrays and we want a concatenated hash. The initial hash allows us to compute such a hash from two arrays easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the other public APIs for hashcode include an initial value argument.
The caller can easily combine the hashcode values themselves as needed.
That’s helpful to know, Let's solve this issue after creating the CSR. |
/csr |
@liach has indicated that a compatibility and specification (CSR) request is needed for this pull request. @linzihao1999 please create a CSR request for issue JDK-8352171 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
The only use case presented was for byte array subranges. While it seems obvious to repeat the pattern for the other types, they might never get used and would just create more surface area to maintain. The Arrays class is already huge. |
Add the java.util.Arrays.hashCode(byte[], int start, int end).
Hi team, I am new here, please give me some guidance. Thank you.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24128/head:pull/24128
$ git checkout pull/24128
Update a local copy of the PR:
$ git checkout pull/24128
$ git pull https://git.openjdk.org/jdk.git pull/24128/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24128
View PR using the GUI difftool:
$ git pr show -t 24128
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24128.diff
Using Webrev
Link to Webrev Comment