Project: JDT
Bug 131288 [nls tooling] Sort order of fields in eclipse style NLS class is wrong
Reported: 2006-03-10 04:22:36 | Status: resolved fixed

I20060307-1315 Given: public class E3 { String s1= Messages.E3_b; String s2= Messages.E3_y; String s3= "a"; String s4= "h"; String s5= "x"; } And: public class Messages extends NLS { private static final String BUNDLE_NAME = "test3.messages";//$NON-NLS-1$ public static String E3_b; public static String E3_y; static {NLS.initializeMessages(BUNDLE_NAME, Messages.class);} } 1. Open 'Externalize Strings...' on E3 2. Externalize all strings, give them names E3_a, E3_h, and E3_x 3. Click finish Result: public class Messages extends NLS { private static final String BUNDLE_NAME = "test3.messages";//$NON-NLS-1$ public static String E3_a; public static String E3_b; public static String E3_x; public static String E3_h; public static String E3_y; static {NLS.initializeMessages(BUNDLE_NAME, Messages.class);} } Expected: public class Messages extends NLS { private static final String BUNDLE_NAME = "test3.messages";//$NON-NLS-1$ public static String E3_a; public static String E3_b; public static String E3_h; public static String E3_y; public static String E3_x; static {NLS.initializeMessages(BUNDLE_NAME, Messages.class);} } Or (same order as in property file): public class Messages extends NLS { private static final String BUNDLE_NAME = "test3.messages";//$NON-NLS-1$ public static String E3_b; public static String E3_y; public static String E3_a; public static String E3_h; public static String E3_x; static {NLS.initializeMessages(BUNDLE_NAME, Messages.class);} }

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/nls/NLSSourceModifierTest.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/nls/AccessorClassModifier.java