Repository navigation
JAVA-7374 Document intentionally empty visitor overrides in SQLInjectionCheck - #6546
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 intentionally empty visitor overrides; executable behavior and SQL-injection analysis remain unchanged, limiting impact to maintainability. 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 return statements from nested classes and lambdas are deliberately not collected. This resolves two java:S1186 violations and makes the intent of the visitor 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 nested comment in the empty visitLambdaExpression override explaining it intentionally does not collect return statements from nested lambdas.
Added a nested comment in the empty visitClass override explaining it intentionally does not collect return statements from nested classes.
SonarQube Remediation Agent uses AI. Check for mistakes.