Repository navigation
JAVA-7373 Document intentionally empty visitor overrides in SQLInjectionCheck - #6545
sonarqube-next[bot] wants to merge 3 commits into
Conversation
…ts reach the query Do not report queries built from provably fixed content: nCopies and stream joins of constants, same-class non-overridable helpers returning constants or constant-only StringBuilders, and format/formatted over constants. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… a read-only builder usage Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Code Review ✅ Approved 🟢 Low riskThe two comments clarify intentional traversal boundaries; executable behavior and SQL-injection analysis remain unchanged, so the change has limited impact. Adds explanatory comments to the empty Verification Rules 2/2 met PRs 2 inspectedFunctional validation No results Rules 2 passed 2 not applicable
Broader impact PRs 2 inspectedCross-PR 2 PRs inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|




Added explanatory comments to the empty visitClass and visitLambdaExpression overrides clarifying that traversal deliberately does not descend into nested/anonymous classes or nested lambdas. This resolves two java:S1186 findings and makes the intent of the no-op methods clear to future maintainers.
View Project in SonarQube
Fixed Issues
java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue 1
java:S1186 - Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. • CRITICAL • View issue 2
Location:
java:java-checks/src/main/java/org/sonar/java/checks/SQLInjectionCheck.java:500Why is this an issue?
An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
What changed
Added a comment inside the empty visitLambdaExpression override explaining that traversal intentionally does not descend into nested lambdas.
Added a comment inside the empty visitClass override explaining that traversal intentionally does not descend into nested/anonymous classes.
SonarQube Remediation Agent uses AI. Check for mistakes.