Bug 80929 - Sort members doesn't work for enums
Summary: Sort members doesn't work for enums
Status: VERIFIED DUPLICATE of bug 80036
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-14 09:55 EST by Dirk Baeumer CLA
Modified: 2005-11-02 06:15 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2004-12-14 09:55:01 EST
public enum EnumTest {
	A , B, C;
	
	void foo() {
		
	}
	
	public Object field;
}
Comment 1 Tobias Widmer CLA 2004-12-14 10:00:56 EST
Annotations seem to work
Comment 2 Steve Samuel CLA 2004-12-15 11:37:32 EST
Not only doesn't work, but completly messes up.
Build id: 200412140010

This code:

package org.sevensoft.emerchant.model;

public class EnumSortTest {

	public enum Suit {
		SPADES, CLUBS, HEARTS, DIAMONDS
	}

	public enum Card {
		KING, QUEEN, JACK, ACE
	}
	
	private String string;
	private int integer;
	
	public void method1() { }
	
	public void method2() { }
}

becomes this after sorting

package org.sevensoft.emerchant.model;

public class EnumSortTest {

	public enum Card {
 ACE
 JACK		KING QUEEN	}

	public enum Suit {
 CLUBS DIAMONDS
 HEARTS		SPADES	}
	private int integer;
	
	private String string;
	
	public void method1() { }
	
	public void method2() { }

}

It's even worse on big classes, splits the enum up and puts parts of it all over
the place, in between methods and everything !
Comment 3 Tobias Widmer CLA 2004-12-15 12:00:41 EST
JDT UI only provides the comparator for CompilationUnitSorter#sort
(ICompilationUnit, int[], Comparator, int, IProgressMonitor).

Moving to JDT Core for comment. This should be fixed for M4.
Comment 4 Olivier Thomann CLA 2004-12-15 15:49:03 EST
The change is too big for M4.

*** This bug has been marked as a duplicate of 80036 ***
Comment 5 Olivier Thomann CLA 2004-12-15 15:50:42 EST
For M4, the action can be disabled for enums.
Comment 6 Philipe Mulet CLA 2004-12-15 15:53:42 EST
When reworking element sorter, we should also attempt to handle logical groups:
fields, methods... I may want to solve methods (no distinction on staticness)
and leave my fields alone.
Comment 7 Dirk Baeumer CLA 2004-12-16 05:58:18 EST
We have disabled the action for M4.
Comment 8 Philip Mayer CLA 2005-11-02 04:53:32 EST
Verified that the current solution in I20051102-0010 correctly handles enums.
Continuing the discussion about the right UI in bug 113338.