Skip to content
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

JDK-8302323 Add repeat methods to StringBuilder/StringBuffer #12728

Closed
wants to merge 14 commits into from

Conversation

JimLaskey
Copy link
Member

@JimLaskey JimLaskey commented Feb 23, 2023

Add the ability to repeatedly append char and CharSequence data to StringBuilder/StringBuffer.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Change requires CSR request JDK-8302686 to be approved
  • Commit message must refer to an issue

Issues

  • JDK-8302323: Add repeat methods to StringBuilder/StringBuffer
  • JDK-8302686: Add repeat methods to StringBuilder/StringBuffer (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12728/head:pull/12728
$ git checkout pull/12728

Update a local copy of the PR:
$ git checkout pull/12728
$ git pull https://git.openjdk.org/jdk.git pull/12728/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12728

View PR using the GUI difftool:
$ git pr show -t 12728

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12728.diff

@JimLaskey
Copy link
Member Author

/csr

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 23, 2023

👋 Welcome back jlaskey! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added rfr Pull request is ready for review csr Pull request needs approved CSR before integration labels Feb 23, 2023
@openjdk
Copy link

openjdk bot commented Feb 23, 2023

@JimLaskey this pull request will not be integrated until the CSR request JDK-8302686 for issue JDK-8302323 has been approved.

@openjdk
Copy link

openjdk bot commented Feb 23, 2023

@JimLaskey The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Feb 23, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 23, 2023

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Mar 2, 2023
@JimLaskey
Copy link
Member Author

Can I get some final reviews?

@AlanBateman
Copy link
Contributor

The repeat codePoint throws IAE if the input is not a valid Unicode code point. Is there a test for that? The tests for IAE seem to be the negative repeat count but maybe I missed it? Also wondering if this needs tests for legacy StringBuffer.

@JimLaskey
Copy link
Member Author

I agree. Will add IAE tests for bad code points and create as second set of tests for StringBuffer.

@stsypanov
Copy link
Contributor

Should we also have overloaded method accepting position to insert repeated value? Smth like repeat(int pos, char c, int count)?

Copy link
Member

@cl4es cl4es left a comment

Choose a reason for hiding this comment

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

It seems reasonable to consider analogous insert methods. Perhaps a more consistent naming scheme would be appendRepeated and insertRepeated? (The precedent for repeat in String::repeat is there, but is kind of weak since it's clear in that case that we're not mutating internal state)

}

try {
sb.repeat(0x10FFFF + 1, -1);
Copy link
Member

Choose a reason for hiding this comment

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

Should these tests that test invalid codepoints use a valid repeat count as to verify the IAE is correctly thrown for the out-of-bound codepoint? Tests where both params are illegal are fine, too, of course.

Copy link
Member

@cl4es cl4es left a comment

Choose a reason for hiding this comment

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

Looks ok. I don't have a strong opinion on insert-repeat.

I think tests that check for illegal code points should use a legal repeat value.

@openjdk
Copy link

openjdk bot commented Mar 28, 2023

@JimLaskey 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:

8302323: Add repeat methods to StringBuilder/StringBuffer

Reviewed-by: tvaleev, redestad

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 133 new commits pushed to the master branch:

  • cddaf68: 8304962: sun/net/www/http/KeepAliveCache/B5045306.java: java.lang.RuntimeException: Failed: Initial Keep Alive Connection is not being reused
  • a06f461: 8303214: Typo in java.util.Collections#synchronizedNavigableMap javadoc
  • 7987ad4: 8304412: Serial: Refactor old generation cards update after Full GC
  • 3c4cd50: 8304963: HttpServer closes connection after processing HEAD after JDK-7026262
  • 4f625c0: 8304543: Modernize debugging jvm args in test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/value/value004.java
  • 426025a: 8303526: Changing "arbitrary" Name.compareTo() ordering breaks the regression suite
  • 6aec6f3: 8304931: vm/concepts/methods/methods001/methods00101m1/methods00101m1 failures with already pending exception
  • 63ce88b: 8304147: JVM crash during shutdown when dumping dynamic archive
  • 554bccf: 8304448: Kitchensink failed: assert(!thread->is_in_any_VTMS_transition()) failed: class prepare events are not allowed in any VTMS transition
  • 3b88b2a: 8304761: Update IANA Language Subtag Registry to Version 2023-03-22
  • ... and 123 more: https://git.openjdk.org/jdk/compare/7277bb19f128b84094400cb4262b2e0432e559c5...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 28, 2023
@JimLaskey
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Apr 3, 2023

Going to push as commit 9b9b5a7.
Since your change was applied there have been 211 commits pushed to the master branch:

  • dd7ca75: 8305478: [REDO] disable gtest/NMTGtests.java sub-tests failing due to JDK-8305414
  • f9827ad: 8288109: HttpExchangeImpl.setAttribute does not allow null value after JDK-8266897
  • 6010de0: 8305417: disable gtest/NMTGtests.java sub-tests failing due to JDK-8305414
  • 127afd3: 8241613: Suspicious calls to MacroAssembler::null_check(Register, offset)
  • 33d09e5: 8305247: On RISC-V generate_fixed_frame() sometimes generate a relativized locals value which is way too large
  • 790aced: 8305100: [REDO] Clean up JavadocTokenizer
  • 2e91585: 8303123: Add line break opportunity to single type parameters
  • 094e03d: 8299718: JavaDoc: Buttons to copy specific documentation URL are not accessible
  • 4de24cd: 8303210: [linux, Windows] Make UseSystemMemoryBarrier available as product flag
  • 336a23e: 8303229: JFR: Preserve disk repository after exit
  • ... and 201 more: https://git.openjdk.org/jdk/compare/7277bb19f128b84094400cb4262b2e0432e559c5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 3, 2023
@openjdk openjdk bot closed this Apr 3, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 3, 2023
@openjdk
Copy link

openjdk bot commented Apr 3, 2023

@JimLaskey Pushed as commit 9b9b5a7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
9 participants