• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pmd / pmd / 796
80%

Build:
DEFAULT BRANCH: main
Ran 12 Sep 2026 01:01PM UTC
Jobs 1
Files 2202
Run time 3min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Sep 2026 12:30PM UTC coverage: 79.468% (+0.02%) from 79.447%
796

push

github

web-flow
[java] Fix #6513: SimplifyConditional detects null check separated from instanceof by a && chain (#6946)

* [java] Fix #6513: SimplifyConditional detects null check separated from instanceof by a && chain

The rule only checked the operand directly adjacent to the instanceof for a
null check on the same subject. When additional conditions sit in the same
&& (or || with negated instanceof) chain, the adjacent operand is itself a
compound expression and the redundant null check was missed.

Traverse the whole sibling short-circuit chain, reusing isNullCheck with the
existing StablePathMatcher so null checks on unrelated expressions are still
ignored. Adds && / || chain regression tests plus a negative test.

Signed-off-by: 付典 <fudianchn@gmail.com>

* [java] Fix #6513: detect the redundant null check at any position in the short-circuit chain

Scan all leaf operands of the surrounding same-operator chain in
evaluation order instead of only the sibling of the instanceof, so the
null check is reported whether it comes before or after the instanceof,
or the instanceof sits in the middle, in both the && and the negated ||
form. Several redundant null checks on the same subject are each
reported; with several instanceofs on the subject in one chain, only
the first one reports, so null checks are not reported once per
instanceof. Describe in the rule that within a chain, the instanceof
must be evaluated before other operands using the subject once the
null check is dropped.

* [java] Fix #6513: dedicated message when the null check alone cannot be removed

When an operand evaluated between the null check and the instanceof uses
the subject, removing the null check alone could make it throw a
NullPointerException; report those chains with a message suggesting to
move the instanceof first instead. Null checks and instanceofs on the
subject in between cannot throw, and operands after the instanceof stay
guarded by it, so there the null check can simply be removed... (continued)

19805 of 25916 branches covered (76.42%)

Branch coverage included in aggregate %.

46 of 46 new or added lines in 1 file covered. (100.0%)

42758 of 52811 relevant lines covered (80.96%)

0.82 hits per line

Jobs
ID Job ID Ran Files Coverage
1 796.1 12 Sep 2026 01:01PM UTC 2202
79.47
GitHub Action Run
Source Files on build 796
  • Tree
  • List 2202
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #796
  • dd5b3e5b on github
  • Prev Build on main (#795)
  • Next Build on main (#797)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc