Affects PMD Version:
6.22.0
Rule:
UseCollectionIsEmpty
Description:
UseCollectionIsEmpty can not detect the case this.foo.size()
.
AST analyse result of the code sample:
<PrimaryPrefix FindBoundary='false' Image='' SingleLine='true' SuperModifier='false' ThisModifier='true' /> <PrimarySuffix ArgumentCount='-1' Arguments='false' ArrayDereference='false' FindBoundary='false' Image='condLink' SingleLine='true' /> <PrimarySuffix ArgumentCount='-1' Arguments='false' ArrayDereference='false' FindBoundary='false' Image='size' SingleLine='true' /> <PrimarySuffix ArgumentCount='0' Arguments='true' ArrayDereference='false' FindBoundary='false' Image='' SingleLine='true'> <Arguments ArgumentCount='0' FindBoundary='false' Image='' SingleLine='true' Size='0' /> </PrimarySuffix>
In the case if (this.condLink.size() == 0) {
, PrimaryPrefix is '', may cause error in comparing whether PrimaryPrefix is collection
Code Sample demonstrating the issue:
if (this.condLink.size() == 0) {
Expected outcome:
false-negative
Running PMD through:
CLI
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4