Community
Participate
Working Groups
Build ID: M20080903-2000 Set comment line width to 78, and run formatter on something with some paragraph length JavaDoc. Comments will be wrapped, but with some lines will have a maximum width of 79 columns, not 78. This appears to be an off-by-one error. The formatter is working, and well. We use the code formatter to normalize a largish code base both in development in Eclipse and via the command line for others. Suddenly, everything wants to reformat, and careful investigation shows it to now be wrapping at column 79 instead of 78. (we use 78 so that when documentation is in a diff it doesn't wrap in an 80 column wide terminal. Quite handy, actually) Obviously I could try setting the width to 77 as a workaround, but then if this is fixed everything will break again. AfC
Can you provide a small code snippet showing the issue to help me to figure out what happen exactly in your case?
Note that I cannot reproduce the problem using the same build... Consider the following test case: public interface Test1 { /** Maximum line width for comments = 69: this___word_ends_at_68 */ void unchanged(); /** Maximum line width for comments = 69: this___word_ends_at__69 */ void splitCommentNotLine(); /** Maximum line width for comments = 69: this___word_ends_at___70 */ void splitCommentAndLine(); } Format it using profile 'Eclipse [built-in]' + Max line width for comments=69 + Tab policy=Spaces only (that helps to make the snippet more readable in bugzilla comments...), and you'll get: public interface Test1 { /** Maximum line width for comments = 68: this___word_ends_at_68 */ void unchanged(); /** * Maximum line width for comments = 68: this___word_ends_at__69 */ void splitCommentNotLine(); /** * Maximum line width for comments = 68: * this___word_ends_at___70 */ void splitCommentAndLine(); } The first comment is not split as it text is not over the max width (same as 3.3). The second comment is split but the line is not as after the comment split, the line does not exceed the max width. The third comment is split and the line as well because even after the comment split the line exceeds the max width from 1 char. Here's another similar test case: public interface Test2 { /** * Maximum line width for comments = 68: this____word_ends_at_68 */ void unchanged(); /** * Maximum line width for comments = 68: this____word_ends_at__69 */ void splitLine(); } Format it using the same profile than previous test case. You'll get: public interface Test2 { /** * Maximum line width for comments = 68: this____word_ends_at_68 */ void unchanged(); /** * Maximum line width for comments = 68: * this____word_ends_at__69 */ void splitLine(); }
(In reply to comment #2) Sorry, first test case should be: public interface Test1 { /** Maximum line width for comments = 68: this___word_ends_at_68 */ void unchanged(); /** Maximum line width for comments = 68: this___word_ends_at__69 */ void splitCommentNotLine(); /** Maximum line width for comments = 68: this___word_ends_at___70 */ void splitCommentAndLine(); }
Without failing snippet, I consider this bug as WORKSFORME based on given comment 2 and comment 3 tests cases...
Verified for 3.6M1 using build I20090802-2000