fb-contrib icon indicating copy to clipboard operation
fb-contrib copied to clipboard

False Positive On DMC_DUBIOUS_MAP_COLLECTION

Open AmitKumarDeoghoria opened this issue 5 months ago • 1 comments

From Comment : https://github.com/checkstyle/checkstyle/pull/17312#issuecomment-3033784610

The SpotBugs fb-contrib extension reports a false positive for DMC_DUBIOUS_MAP_COLLECTION, suggesting that a Map should be replaced with a List. However, in this case, the Map is intentionally used to enable efficient key-based lookups, which a List cannot provide. The current structure is necessary and aligns with the actual usage pattern, so no change is needed.

AmitKumarDeoghoria avatar Jul 04 '25 06:07 AmitKumarDeoghoria

I ran spotbugs/sb-contrib against the master branch of checkstyle, and didn't see the issue, sb-contrib notices that in resolveEntity() a get call is used, and correctly no longer considers the map as a possible candidate.

Is there some other branch you are using that shows this?

mebigfatguy avatar Jul 06 '25 02:07 mebigfatguy