Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 422184

Summary: [hashcode/equals] Unnecessary warning about lack of equals() and hashCode() in SortedMap
Product: [Eclipse Project] JDT Reporter: Evan Brodie <ecb0628>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.3   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Evan Brodie CLA 2013-11-20 14:55:27 EST
Please see the following related Stackoverflow post http://stackoverflow.com/questions/20102111/eclipse-warning-about-sortedmap-not-redeclaring-equals-and-hashcode. This Eclipse bug is a follow up to that post.

I have a Java class (let's call it Foo) that has a java.util.SortedMap member. When I generate the hashCode() and equals() methods for Foo, Eclipse prints out the following warning message:

"The field type 'java.util.SortedMap' does not redeclare equals() and hashCode() - the resulting code may not work correctly."

This warning message is not necessary and is actually invalid. SortedMap extends Map, and hashCode() and equals() are listed in the Map interface, so that is already enough to guarantee that all implementations of the SortedMap interface will have an overridden implementation of hashCode() and equals(). Therefore, Eclipse should not have printed this warning message.
Comment 1 Eclipse Genie CLA 2019-07-14 12:55:12 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.