A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2542 below:

[java] UseCollectionIsEmpty can not detect the case foo.bar().size() · Issue #2542 · pmd/pmd · GitHub

Affects PMD Version:
6.22.0
Rule:
UseCollectionIsEmpty

Description:
UseCollectionIsEmpty can not detect the case foo.bar().size().
AST analyse result of the code sample:

<PrimaryPrefix FindBoundary='false' Image='' SingleLine='true' SuperModifier='false' ThisModifier='false'>
	<Name FindBoundary='false' Image='vr.getMembers' SingleLine='true' />
</PrimaryPrefix>
<PrimarySuffix ArgumentCount='0' Arguments='true' ArrayDereference='false' FindBoundary='false' Image='' SingleLine='true'>
    <Arguments ArgumentCount='0' FindBoundary='false' Image='' SingleLine='true' Size='0' />
</PrimarySuffix>
    <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 vr.getMembers().size(), PrimaryPrefix is vr.getMembers, may cause error in comparing whether PrimaryPrefix is collection

Code Sample demonstrating the issue:

while (vr.getMembers().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