Skip to content

Prefer StringBuilder for local variables - #368

Merged
elharo merged 2 commits into
masterfrom
buf
Feb 6, 2026
Merged

Prefer StringBuilder for local variables#368
elharo merged 2 commits into
masterfrom
buf

Conversation

@elharo

@elharo elharo commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

since they don't need synchronization

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR converts local StringBuffer variables to StringBuilder for better performance, since local variables don't require the thread-safety overhead of StringBuffer's synchronized methods.

Changes:

  • Changed StringBuffer to StringBuilder in XmlWriterUtil's writeComment method
  • Changed StringBuffer to StringBuilder in StringUtils' uncapitalise method
  • Changed StringBuffer to StringBuilder in StringUtils' reverse method

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/main/java/org/apache/maven/shared/utils/xml/XmlWriterUtil.java Converted local StringBuffer variable to StringBuilder in the writeComment method
src/main/java/org/apache/maven/shared/utils/StringUtils.java Converted local StringBuffer instances to StringBuilder in uncapitalise and reverse methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@elharo

elharo commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.apache.maven.shared:maven-shared-utils:3.4.3-SNAPSHOT: The following artifacts could not be resolved: org.apache.maven.shared:maven-shared-components:pom:47 (absent): Could not transfer artifact org.apache.maven.shared:maven-shared-components:pom:47 from/to central (https://repo.maven.apache.org/maven2): PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed and 'parent.relativePath' points at wrong local POM @ line 23, column 11
@

@elharo
elharo marked this pull request as ready for review February 4, 2026 22:46
@elharo
elharo requested a review from slachiewicz February 4, 2026 22:46
@elharo
elharo merged commit 3fba762 into master Feb 6, 2026
27 checks passed
@elharo
elharo deleted the buf branch February 6, 2026 21:16
@github-actions github-actions Bot added this to the 3.5.0 milestone Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants