Skip to content

Java: Add test showing correct usage #19560

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

Merged

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented May 22, 2025

As suggested in this comment.

@Copilot Copilot AI review requested due to automatic review settings May 22, 2025 13:31
@owen-mc owen-mc requested a review from a team as a code owner May 22, 2025 13:31
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label May 22, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a test demonstrating correct usage of String.replace instead of String.replaceAll for non-regex replacements.

  • Introduces a compliant example in Test.java using String.replace.
  • Updates the Performance documentation with the same compliant example.

Reviewed Changes

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

File Description
java/ql/test/query-tests/StringReplaceAllWithNonRegex/Test.java Added a String.replace("t", "x") // COMPLIANT example in the test.
java/ql/src/Performance/StringReplaceAllWithNonRegex.md Updated documentation to include the new compliant String.replace example.

Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

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

LGTM

@owen-mc owen-mc merged commit 8b68d95 into github:main May 22, 2025
13 checks passed
@owen-mc owen-mc deleted the java/add-stringreplaceallwithnonregex-test branch May 22, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Java no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants