[doc] [java] SuspiciousEqualsMethodName: update description, fixes #2264
This commit is contained in:
@ -3052,8 +3052,12 @@ StringBuilder sb4 = new StringBuilder("c");
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#suspiciousequalsmethodname">
|
||||
<description>
|
||||
The method name and parameter number are suspiciously close to equals(Object), which can denote an
|
||||
intention to override the equals(Object) method.
|
||||
The method name and parameter number are suspiciously close to Object.equals, which can denote an
|
||||
intention to override it. However, the method does not override Object.equals, but overloads it instead.
|
||||
Overloading Object.equals method is confusing for other programmers, error-prone and hard to main,
|
||||
especially when using inheritance, because @Override annotations used in subclasses can provide a false
|
||||
sense of security. For more information on Object.equals method, see Effective Java, 3rd Edition,
|
||||
Item 10: Obey the general contract when overriding equals.
|
||||
</description>
|
||||
<priority>2</priority>
|
||||
<properties>
|
||||
|
Reference in New Issue
Block a user