Skip to content

Commit

Permalink
toUpperCase() should compare to a capitalized string
Browse files Browse the repository at this point in the history
  • Loading branch information
ciufudean committed Oct 19, 2023
1 parent 2bbb193 commit 453685d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pmd-java/src/main/resources/category/java/errorprone.xml
Expand Up @@ -3204,9 +3204,9 @@ Using equalsIgnoreCase() is faster than using toUpperCase/toLowerCase().equals()
<priority>3</priority>
<example>
<![CDATA[
boolean answer1 = buz.toUpperCase().equals("baz"); // should be buz.equalsIgnoreCase("baz")
boolean answer1 = buz.toUpperCase().equals("BAZ"); // should be buz.equalsIgnoreCase("BAZ")
boolean answer2 = buz.toUpperCase().equalsIgnoreCase("baz"); // another unnecessary toUpperCase()
boolean answer2 = buz.toUpperCase().equalsIgnoreCase("BAZ"); // another unnecessary toUpperCase()
]]>
</example>
</rule>
Expand Down

0 comments on commit 453685d

Please sign in to comment.