Community
Participate
Working Groups
Created attachment 249565 [details] The above code exactly as the Eclipse formatter formats it I created a new default Eclipse code formatter, then set all wrap settings to "Wrap as necessary". With a wrap width of 60, the following code is shown post-formatting. I will also attach the code as an attachment. Look at the attached version instead, since bugs.eclipse.org is going to wrap the text itself in places where Eclipse is not wrapping it -- the following is just included as a quick reference. import java.util.ArrayList; public class FormatWidthProblems { // format width ---------------------------------------| static class ReallyLongClassNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX { } public static void main(String[] args) { int[] reallyLongArrayNameZZZZZZZZZZZZZZZZZZZZZZZZZ = new int[0]; for (int reallyLongVariableNameZZZZZZZZZZZZZZZZZZZZZZZZZ : reallyLongArrayNameZZZZZZZZZZZZZZZZZZZZZZZZZ) { } int reallyLongVariableName1 = 1, reallyLongVariableName2 = 2, reallyLongVariableName3 = 3; ArrayList<Integer> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = new ArrayList<>(); ArrayList<ReallyLongClassNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX> xxxxxxxxxxxxxxxxxxxxx = new ArrayList<>(); } // format width ---------------------------------------| }
Another example I just came across: for (int segIdx = 0, escapePos = -1, escapedByte = 0, nSeg = segment.length(); segIdx < nSeg; segIdx++) { The line width in this example is 108 characters, which is between "sexIdx" and "++". All of "++) {" sticks out past the wrap boundary even after formatting.
Moving to JDT Core for comments.
Created attachment 249627 [details] Another example Another example, all of "|| fieldType == Double.TYPE)) {" sticks out past the maximum wrap width of 120.
Manoj, please respond.
This problem no longer occurs after the formatter redesign. If some lines do go over the width limit, it means they don't contain any spot where wrapping can be introduced. If a new kind of spot should be added as an option, that's for a new bug report. *** This bug has been marked as a duplicate of bug 303519 ***
Verified for 4.7 M5 using I20170123-2000 build