Project: JDT
Bug 218542 [clean up] sort members sorts fields by visibility even if field sorting is disabled
Reported: 2008-02-11 13:46:01 | Status: verified fixed

Sort-members-but-ignore-fields fails to prevent sorting by member access, which results in field reordering that causes compiler error. (1) In Preferences, (a) In Java, editor, save action, enable "Code Organizing" tab, "Members" section, "Sort members" checkbox and "Ignore fields and enum constants" radio button (b) In Java, appearance, Members Sort Order, enable checkbox "Sort members in same category by visibility" (2) Create the following class: package main; public class Main { static final Object b = "a"; public static final Object a = b; } (3) Edit (add spaces) and save RESULT: a re-ordered before b, causing compile-time error True in 3.4M5 and 3.3.1.1. Workaround: disable (1)(a) or (b). This means we can't use save actions to enforce code formatting for our team. We do want methods sorted.

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/SortMembersOperation.java