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

Bug 428834

Summary: "Generate hashCode and equals()" ignores protected fields from superclasses
Product: [Eclipse Project] JDT Reporter: Michael Mirwaldt <michael.mirwaldt>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 4.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Michael Mirwaldt CLA 2014-02-22 19:11:32 EST
The "Generate toString"-menu-item takes protected fields from superclasses into consideration but "Generate hashCode and Equals()"-menu-item ignores them. As subclasses also inherit protected fields from superclasses, the "Generate hashCode and Equals()" should give the user the opportunity to choose them. The generator then generates a hashCode() and equals() which include the inherited fields.
Comment 1 Michael Mirwaldt CLA 2014-02-25 18:28:37 EST
I notices that equals-methods of subclasses call the quals-method of superclasses which is much better. However, this makes only sense if the super class also implements equals.