Skip to content

fix(java): avoid eqeq false positives on null checks - #4028

Open
0xTaoZ wants to merge 1 commit into
semgrep:developfrom
0xTaoZ:agent/fix-java-eqeq-ternary
Open

fix(java): avoid eqeq false positives on null checks#4028
0xTaoZ wants to merge 1 commit into
semgrep:developfrom
0xTaoZ:agent/fix-java-eqeq-ternary

Conversation

@0xTaoZ

@0xTaoZ 0xTaoZ commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Rationale

The rule is meant to report expressions like x == x or x != x. A ternary guard such as expr != null ? ... : ... is valid control flow and should not be reported as a self-comparison.

Fixes #4019.

Validation

  • uvx semgrep --test --config java/lang/correctness/eqeq.yaml java/lang/correctness/eqeq.java
  • uvx semgrep --validate --config java/lang/correctness/eqeq.yaml
  • uvx semgrep --test --config java/lang/correctness java/lang/correctness
  • git diff --check

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive for java.lang.correctness.eqeq.eqeq

2 participants