A RetroSearch Logo

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

Search Query:

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

[java] UnnecessaryCaseChange can not detect the case like: foo.equals(bar.toLowerCase()) · Issue #2531 · pmd/pmd · GitHub

Affects PMD Version:
6.22.0

Rule:
UnnecessaryCaseChange

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