Bug 294631

Summary: [formatter] The formatter takes two passes to format a common sequence of html tags
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: Olivier_Thomann, 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-09 11:26:14 EST
Build 3.6M3 but exists since 3.4.

Consider the following test case:
package wkps3;

/**
 * This comment makes the formatter unstable:
 * 
 * <ol>
 *   <li><p> first line
 *   second line</li>
 * </ol>
 */
public class X {

}

The format output when using Eclipse built-in profile is:
package wkps3;

/**
 * This comment makes the formatter unstable:
 * 
 * <ol>
 * <li>
 * <p>
 * first line second line
 * </li>
 * </ol>
 */
public class X {

}

And format it again produces the following different output:
package wkps3;

/**
 * This comment makes the formatter unstable:
 * 
 * <ol>
 * <li>
 * <p>
 * first line second line</li>
 * </ol>
 */
public class X {

}
Comment 1 Frederic Fusier CLA 2009-11-09 11:27:09 EST
Using 3.3.2, the formatter directly produces the last output, hence this one is a real regression...
Comment 2 Frederic Fusier CLA 2009-11-09 17:15:27 EST
Created attachment 151748 [details]
Proposed patch

In this peculiar sequence, the last html tag taken into account was <p> which supposes to have a new line after its closing tag. But here, there's no closing tag for <p>, hence no new line needs to be added after the end of the text.

Modify the return of the printJavadocHtmlTag(...) method to return the correct value when the html tag does not really end with a closing tag...
Comment 3 Frederic Fusier CLA 2009-11-09 17:16:06 EST
Released for 3.6M4 in HEAD stream.
Comment 4 Satyam Kandula CLA 2009-12-08 05:18:31 EST
Verified for 3.6M4 using Build id: I20091207-1800