Affects PMD Version:6.42.0
Rule:UseEqualsToCompareStrings
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_errorprone.html#useequalstocomparestrings
Description:
Hi, I found a false negative about the rule UseEqualsToCompareStrings. Please review the following code example. PMD should have reported a warning at line 5 because the string x is compared with another string, but it doesn't. Hence, I think it is a false negative.
Code Sample demonstrating the issue:
String getLiteral() { return "hello"; } void UseEqualsToCompareStrings(String x) { if (x == getLiteral()) {} // a false negative should report }
Expected outcome:
PMD should report a violation at line 5, but doesn't. This is a false-negative.
Running PMD through: [Maven]
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