-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8361299: (bf) CharBuffer.getChars(int,int,char[],int) violates pre-existing specification #26104
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
…isting specification
/csr |
👋 Welcome back bpb! A progress list of the required criteria for merging this PR into |
@bplb This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 14 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@bplb has indicated that a compatibility and specification (CSR) request is needed for this pull request. @bplb please create a CSR request for issue JDK-8361299 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
Webrevs
|
|
Mailing list message from Brian Burkhalter on nio-dev: On Jul 2, 2025, at 2:49?PM, Brett Okken <duke at openjdk.org> wrote: Marked as reviewed by bokken at github.com<mailto:bokken at github.com> (no known OpenJDK username). Thanks for the review. |
* {@code position() + srcBegin} in this buffer and at offset | ||
* {@code dstBegin} in the array. The position of this buffer is unchanged. | ||
* | ||
* <p> An invocation of this method behaves exactly the same was as the |
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.
I think we can use an implSpec for this and keep "This method is equivalent to".
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.
I think we can use an implSpec for this and keep "This method is equivalent to".
I was following the existing convention elsewhere in the file.
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.
I don't know why JDK-8343110 put the implSpec after the param/return/throws tags so happy it has been fixed. Maybe at some point we can use implSpec to these methods.
@@ -71,6 +71,19 @@ public void testSrcBeginIsNegative() { | |||
() -> CB.getChars(-1, 3, new char[4], 0)); | |||
} | |||
|
|||
@Test | |||
public void testSrcBeginIsNegationOfPosition() { |
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.
I skimmed through GetChars and I see it only tests a CB created with CharBuffer.wrap, only testGetChars tests all char buffers. All the test methods should be tested all char buffer implementations. So maybe we can create a follow-up issue to improve this test (and probably migrate it to a JUnit test too).
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.
So maybe we can create a follow-up issue to improve this test (and probably migrate it to a JUnit test too).
Agreed. I also noticed it is TestNG now.
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.
Okay, let's create a follow-up issue for that.
Modify
CharBuffer.getChars
to respect the class level specification that the provided buffer offsetsrcBegin
is relative to the buffer's current position.Progress
Issues
Reviewers
Reviewers without OpenJDK IDs
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26104/head:pull/26104
$ git checkout pull/26104
Update a local copy of the PR:
$ git checkout pull/26104
$ git pull https://git.openjdk.org/jdk.git pull/26104/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26104
View PR using the GUI difftool:
$ git pr show -t 26104
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26104.diff
Using Webrev
Link to Webrev Comment