22 lines
456 B
Plaintext
22 lines
456 B
Plaintext
![]() |
An ``++equals++`` method that unconditionally returns the same answer is an error likely to cause many bugs.
|
||
|
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
public class Fruit extends Food {
|
||
|
private Season ripe;
|
||
|
|
||
|
public boolean equals(Object obj) {
|
||
|
return ripe.equals(this); // Noncompliant
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
ifdef::env-github,rspecator-view[]
|
||
|
== Comments And Links
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::comments-and-links.adoc[]
|
||
|
endif::env-github,rspecator-view[]
|