Bug 204047

Summary: [source generation] Generate Comparable implementation
Product: [Eclipse Project] JDT Reporter: Mike M <gubespam>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, martinae, Olivier_Thomann
Version: 3.3Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Mike M CLA 2007-09-19 18:25:40 EDT
Today we can generate equals() and hashCode() implementations for classes.  I suggest adding a feature that would add "implements java.lang.Comparable<X>" to the class (if not already present) and generate implementation code for the compareTo() method.  A dialog would allow the selection of which member variables should be pertitent, just like we have for the equals/hashCode generator today.

A question for debate: should we provide an option as to whether the Comparable interface used is genericized or not?  Either way, should we allow the user to specify what the type parameter is, or always use the current class type?  Or instead of allowing any old type, allow the user to choose a type from the class' inheritance ancestry.
Comment 1 Olivier Thomann CLA 2007-09-19 20:01:45 EDT
Move to JDT/UI