I can't say for sure but it's very probably because the generation creates a line like if <field-x equals other-field-x> return false; for each of the fields of the class plus a single line return true; at the end.
If you happen to have only a single field in the class you end up with this degenerated form.
You could search Jira for a similar issue (there are quite a couple of issues regarding code generation of equals() and hashCode()) and then vote or create a new issue.
Ok, sure, let me rephrase: Why doesn't IDEA do this for single (or few) fields?
regards,
Messi
Stephen Friedrich wrote:
I can't say for sure but it's very probably because the generation creates a line like if <field-x equals other-field-x> return false; for each of the fields of the class plus a single line return true; at the end.
If you happen to have only a single field in the class you end up with this degenerated form.
You could search Jira for a similar issue (there are quite a couple of issues regarding code generation of equals() and hashCode()) and then vote or create a new issue.
I can't say for sure but it's very probably because the generation creates a line like
if <field-x equals other-field-x> return false;
for each of the fields of the class plus a single line
return true;
at the end.
If you happen to have only a single field in the class you end up with this degenerated form.
You could search Jira for a similar issue (there are quite a couple of issues regarding code generation of equals() and hashCode()) and then vote or create a new issue.
Ok, sure, let me rephrase:
Why doesn't IDEA do this for single (or few) fields?
regards,
Messi
Stephen Friedrich wrote: