Affects PMD Version:
6.22.0
Description:
UnnecessaryCaseChange can not detect the case like: foo.equals(bar.toLowerCase())
.
This rule is implemented in File: pmd-java-6.22.0-sources.jar!\net\sourceforge\pmd\lang\java\rule\errorprone\UnnecessaryCaseChangeRule.java.
Firstly, use if (image == null || !(image.endsWith("toUpperCase") || image.endsWith("toLowerCase")))
to check if PrimarySuffix has toUpperCase
or toLowerCase
.
Then, use if (suffix.getImage() == null || !(suffix.hasImageEqualTo("equals") || suffix.hasImageEqualTo("equalsIgnoreCase"))) {
to check if PrimarySuffix has equals
.
So this rule can not detect the case:foo.equals(bar.toLowerCase())
.
Code Sample demonstrating the issue:
foo.equals(bar.toLowerCase())
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