Bug 294631 - [formatter] The formatter takes two passes to format a common sequence of html tags
Summary: [formatter] The formatter takes two passes to format a common sequence of htm...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-09 11:26 EST by Frederic Fusier CLA
Modified: 2009-12-08 05:51 EST (History)
3 users (show)

See Also:


Attachments
Proposed patch (3.06 KB, patch)
2009-11-09 17:15 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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