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

Bug 127406

Summary: [content assist] Content assist for anonymous type reverses order of method stubs
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: nobody
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2006-02-12 18:42:33 EST
I20060210-1640, already the same in M4

Content assist for creating an anonymous type of an interface reverses the order of method stubs with respect to the interface declaration. I would expect to get the same order as in the interface. The quick fix to add missing methods and Source > Override/Implement Methods... already behave as expected.

interface I {
    void a();
    void b();
    void c();
}

public class Try {
	public static void main(String[] args) {
		new I( // content assist here
	}
}

Content assist yields:

public class Try {
	public static void main(String[] args) {
		new I(){
			public void c() {
				// TODO Auto-generated method stub
			}
			public void b() {
				// TODO Auto-generated method stub
			}
			public void a() {
				// TODO Auto-generated method stub
			}
		}; // content assist here
	}
}
Comment 1 Nobody - feel free to take it CLA 2006-12-02 17:29:06 EST
In Eclipse 3.2.1 the method order is alphabetical instead of reversed. This is almost as annoying. 

The method generation should follow the order in the interface. At least the alphabetical sorting should be a config option that can be turned off.
Comment 2 Eclipse Genie CLA 2020-02-01 10:30:05 EST
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.