24 lines
474 B
Plaintext
24 lines
474 B
Plaintext
An ``++equals++`` method that unconditionally returns the same answer is an error likely to cause many bugs.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,java]
|
|
----
|
|
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[]
|