Naming a method ``++tostring++``, ``++hashcode++`` or ``++equal++`` is either:
* A bug in the form of a typo. Overriding ``++toString++``, ``++Object.hashCode()++`` (note the camelCasing) or ``++Object.equals++`` (note the 's' on the end) was meant, and the application does not behave as expected.
* Done on purpose. The name however will confuse every other developer, who may not notice the naming difference, or who will think it is a bug.
@Ann I linked this issue to RSPEC-1201, I'll let you update description and findbugs reference.
=== on 11 Feb 2015, 20:25:04 Ann Campbell wrote:
\[~nicolas.peru] are you saying you'd like to roll the content of this rule into RSPEC-1201? Because they're actually about (slightly) different things...
=== on 12 Feb 2015, 07:18:50 Nicolas Peru wrote:
\[~ann.campbell.2] I am saying that this rule should not cover the equals method as it is covered by RSPEC-1201. I don't see the difference between the two rules except that one concern equals and the other one hashcode.
=== on 12 Feb 2015, 13:53:05 Ann Campbell wrote:
\[~nicolas.peru], this rule doesn't cover "equals" (with an 's'), it covers "equal". I.e. this rule is about method names that are not-quite-right. RSPEC-1201 is about signatures that are not-quite-right. Or are you saying that in the implementation of RSPEC-1201 you also check this spelling variation?
=== on 12 Feb 2015, 14:23:05 Nicolas Peru wrote:
\[~ann.campbell.2]My bad, I really did not spot the difference between the two rules... I tend to think this one should clearly mention that it detects typo. So this mean that not only description but implementation is out of date in plugin. ticket created : \http://jira.codehaus.org/browse/SONARJAVA-902