This rule is Obsolete | |
Synopsis: | Position literals first in String comparisons |
Language: | Java |
Severity Level: | 3 |
Category: | Design |
Description: |
Position literals first in String comparisons - that way if the String is null you won't get a NullPointerException, it'll just return false.class Foo { boolean bar(String x) { return x.equals("2"); // should be "2".equals(x) } } |