IntelliJ IDEA 15 "Code > Generate" context menu missing "equals() and hashCode()" entry
Asked Answered
A

1

12

In my IntelliJ IDEA 15 (build 143.382), the context menu invoked via "Code > Generate" is missing the "equals() and hashCode()" entry. How can I configure the context menu contents to bring it back?

enter image description here

Abe answered 1/12, 2015 at 9:7 Comment(0)
A
19

My bad, turns out the contents are context-sensitive: I was invoking the menu from a class which didn't have any instance fields...

Abe answered 1/12, 2015 at 9:17 Comment(6)
Sometimes, the tools are almost too smart for us... ;-)Crucifixion
Well, not sure if this is really "smart", I would prefer the menu item to just be disabled rather than absent...Garett
You are right, that would be clearer. The disabled menu items could even show a tool tip explaining the situation.Crucifixion
Even though, if a class inherits from another class (which overwrites equals), shouldn't the subclass also override it to enable that only the instances of the subtype are equal?Experimentation
@FreekdeBruijn i want to use properties instead.Libertinism
Seems also to happen if your class does not have any fields but the extended class does ...Insincere

© 2022 - 2024 — McMap. All rights reserved.