Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 231845 - [formatter] Javadoc comment formatter should use code 'Blank Lines to Preserve' value at the beginning of <pre>...</pre> tags
Summary: [formatter] Javadoc comment formatter should use code 'Blank Lines to Preserv...
Status: CLOSED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.8 M5   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard: To be verified for 4.8 M5
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-13 11:53 EDT by Frederic Fusier CLA
Modified: 2018-01-06 20:33 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2008-05-13 11:53:45 EDT
Follow-up of bug 231263 review:

org.eclipse.jdt.internal.formatter.Scribe.printJavadocHtmlTag(FormatJavadocText,
FormatJavadocBlock, boolean)
- shouldn't the 'Number of empty lines to preserve' be applied inside a <pre>
tag (instead of applying the 'Remove blank lines' option) ?
Comment 1 Frederic Fusier CLA 2008-05-14 07:15:34 EDT
The real problem is in fact for blank lines at the beginning of the code (e.g. after the <pre> tag and before the first character of the snippet) and at the end of the code (e.g. after the last character of the snippet and before the </pre> tag).

The following example:
interface X01 {
	/**
	 * <pre>
	 * 
	 * 
	 * public class Example {final int a= 1;final boolean b= true;}
	 * 
	 * 
	 * </pre>
	 */
	int foo();
}
is currently formatted as follow with Eclipse built-in:
interface X01 {
	/**
	 * <pre>
	 * 
	 * 
	 * public class Example {
	 * 	final int a = 1;
	 * 	final boolean b = true;
	 * }
	 * 
	 * 
	 * </pre>
	 */
	int foo();
}
(Note that Number of empty lines to preserve = 1 for Eclipse built-in settings)

So, the formatted output should be instead:
interface X01 {
	/**
	 * <pre>
	 * 
	 * public class Example {
	 * 	final int a = 1;
	 * 	final boolean b = true;
	 * }
	 * 
	 * </pre>
	 */
	int foo();
}

Note that in 3.3 the output is:
interface X01 {
	/**
	 * <pre>
	 * public class Example {
	 * 	final int a = 1;
	 * 	final boolean b = true;
	 * }
	 * 
	 * </pre>
	 */
	int foo();
}
Comment 2 Robert Roth CLA 2015-05-02 10:45:26 EDT
On eclipse 4.5M6 I get the correct number of empty lines preserved inside <pre> tags. Do you still see this issue with a recent eclipse version?
Comment 3 Mateusz Matela CLA 2018-01-06 20:33:26 EST
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***