Bug 230184

Summary: [formatter] New comment formatter split comment line between contiguous tokens
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, eric_jodet, jerome_lanneluc
Version: 3.4Flags: jerome_lanneluc: review+
Target Milestone: 3.4 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frederic Fusier CLA 2008-05-05 07:42:57 EDT
Using 3.4M7

The new comment formatter split comment incorrectly splits comment lines between contiguous tokens as shown in following sample:
public class X {

boolean inTitle;

void foo(String tagName) {
    inTitle = tagName.equals("<title"); // keep track if in <TITLE>
}
}

formatted as follow with maximum line width for comments = 70:
public class X {

    boolean inTitle;

    void foo(String tagName) {
        inTitle = tagName.equals("<title"); // keep track if in <TITLE
                                            // >
	}
}

Although we should get:
public class X {

    boolean inTitle;

    void foo(String tagName) {
        inTitle = tagName.equals("<title"); // keep track if in
                                            // <TITLE>
	}
}
Comment 1 Frederic Fusier CLA 2008-05-05 07:46:00 EDT
The Scribe.printLineComment(int,int) method also needs to put contiguous tokens into temporary buffer before print them. The same mechanism used for block and javadoc comments also has to be used for line comments.
Comment 2 Frederic Fusier CLA 2008-05-06 05:49:34 EDT
The patch fixing this issue has been attached to bug 230230.
Jerome can you please review?
Comment 3 Frederic Fusier CLA 2008-05-06 07:08:12 EDT
Released for 3.4RC1 in HEAD stream.
Comment 4 Eric Jodet CLA 2008-05-13 06:46:28 EDT
Verified for 3.4RC1 using build I20080510-2000.