Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • You can add them to the interface to define in the javadoc how the implementations should be special (over and above the contract in Object), but there is no static way to have the compiler enforce it. Commented Nov 11, 2009 at 21:19
  • Yes, that would also be a good way to at least have it officially documented. I want to stay away from the inheritance solution; the reason these methods are in an interface in the first place is so I can code against that instead of an implementation. Commented Nov 11, 2009 at 21:39
  • possible duplicate of Force a class to override the .equals method Commented Mar 2, 2015 at 12:56