Bug 295175

Summary: [formatter] Missing space before a string at the beginning of a line in a javadoc comment
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, satyam.kandula, srikanth_sankaran
Version: 3.6   
Target Milestone: 3.6 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2009-11-15 04:36:30 EST
Build N20091112-2000, since bug 294529 has been released.

The following test case:
public class X {
/**
 * <p>
 * "String", this string may be not well formatted in certain circumstances,
 * typically after bug 294529 has been fixed...
 */
void foo() {}
}

is formatted as follow:
public class X {
    /**
     * <p>
     *"String", this string may be not well formatted in certain circumstances,
     * typically after bug 294529 has been fixed...
     */
    void foo() {
    }
}

Note that a space is missing before the "String"...
Comment 1 Frederic Fusier CLA 2009-11-15 04:38:48 EST
This is a side effect of the fix for bug 294529. It exhibits a problem in the comment formatter... The fix is trivial.
Comment 2 Frederic Fusier CLA 2009-11-15 12:39:24 EST
Created attachment 152245 [details]
Proposed patch

Hmmm, finally not so easy... The fact that the exception is now correctly raised, made the formatter typically wrong while computing length of immutable tags. This patch improves the ouptput of more than 1,200 files while running the massive tests on all full source workspaces!
Comment 3 Frederic Fusier CLA 2009-11-15 12:47:46 EST
Here are some other test cases fixed by the patch:

1) InvalidInputException inside a <code> tag

public class X01 {

	/**
	 * Finds the deepest <code>IJavaElement</code> in the hierarchy of
	 * <code>elt</elt>'s children (including <code>elt</code> itself)
	 * which has a source range that encloses <code>position</code>
	 * according to <code>mapper</code>.
	 */
	void foo() {}
}

2) Text starting without space on a javadoc comment line:

public interface X02 {

    /**
     *Formatter misses to insert the space at the beginning of the line
     *<p>In this case also...
     * 
     * <p>
     * <BR>
     *<B>In this case also</B>
     **/
    void foo();
}
Comment 4 Frederic Fusier CLA 2009-11-15 14:32:51 EST
Released for 3.6M4 in HEAD stream.
Comment 5 Satyam Kandula CLA 2009-12-08 05:35:22 EST
Verified for 3.6M4 using Build id: I20091207-1800