Community
Participate
Working Groups
Using build I20080624-0800. Consider the following CU: public class X { public static final int POOL_SIZE = 25; String[] strings; private X() { this.strings = new String[POOL_SIZE]; } public static X newInstance() { return new X(); } public synchronized String foo() { return ""; } public synchronized void bar() { } public void reset() { } } I want to clean-up this CU by sorting members using the default 'Members Sort Order' and without sorting fields, enum constants, etc. Then I get the following output: public class X { public static final int POOL_SIZE = 25; public static X newInstance() { return new X(); } String[] strings; private X() { this.strings = new String[POOL_SIZE]; } public synchronized void bar() { } public synchronized String foo() { return ""; } public void reset() { } } Note that the indentation of the moved static method is really weird and that the indentation of the field has been removed. This is really annoying as this prevents us to apply a general JDT/Core code clean-up we wanted to make before restarting 3.5 dvpt in HEAD... :-(
What are your formatter settings? I wasn't able to reproduce this. I always get: package p; public class X { public static final int POOL_SIZE = 25; public static X newInstance() { return new X(); } String[] strings; ... Note: Because of bug 238943, the sort member operation uses the formatter settings from the workspace, not the project. The code that implements 'sort members' is in JDT/Core (org.eclipse.jdt.internal.core.SortElementsOperation) This code decides to replace a field with a method, so the method will get the same indent as the field.
Could this be related to bug 238943?
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.