Community
Participate
Working Groups
Hello, I reported this issue already two years ago when 3.0 was out (cannot find it now. Probably deleted). It was closed with comment "Post 3.1". Now with 3.2 I still have the same error. Eclipse 3.x is unable to produce the same Code Formatter results as Eclipse 2.1.2, even though there is a "Eclipse 2.1" mode and although there are many tweak settings. This causes me to have thousands of code differences in my source-code-revision system to appear as soon as I format older code (created in 2.1.2) with the new version. I have created an artificial example that demonstrates my main problem. This is the code as produced and formatted by 2.1.2: >>>>>>>>>>>>>>>>>>>>>>>>>>>>> package demo.formatter; public class FormatterDemo { public void fooBar() { SomeOtherClass instanceOfOtherClass = new SomeOtherClass(); /* The following statement demonstrates the formatter issue */ SomeOtherClass.someMethodInInnerClass( instanceOfOtherClass.anotherMethod("Value of paramter 1"), instanceOfOtherClass.anotherMethod("Value of paramter 2")); } private static class SomeOtherClass { public static void someMethodInInnerClass( String param1, String param2) { } public String anotherMethod(String par) { return par; } } } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< The critical part is the method invocation. The best I can get out of Eclipse 3.x looks like this: /* The following statement demonstrates the formatter issue */ SomeOtherClass.someMethodInInnerClass(instanceOfOtherClass .anotherMethod("Value of paramter 1"), instanceOfOtherClass .anotherMethod("Value of paramter 2")); Besides that it creates many differences in source-code-revision system, it is also quite bad in visual style compared to the Eclipse 2.1.2 result. Kind regards, Juergen Kremp
Remark: The fact that the artificial example uses an inner class to demonstrate the problem is just to have the example compact. The issue appears with any nested method invocation exceeding the configured line length (in my case 80). The other wrappings are also affected (binary expressions, paramters, ...).
There is no intention to get the exact same formatting between 3.x and 2.1. However the resulting formatting string that you show should be improved.
*** This bug has been marked as a duplicate of 59891 ***
Verified for 3.6M7 using build I20100424-2000.