Bug 315577 - [formatter] No line break after <br> if followed by {@link when formatting java source file
Summary: [formatter] No line break after <br> if followed by {@link when formatting ja...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.7 M1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 09:07 EDT by Ludovic WALLE CLA
Modified: 2010-08-04 02:16 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (3.73 KB, patch)
2010-06-23 09:50 EDT, 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 Ludovic WALLE CLA 2010-06-03 09:07:13 EDT
Build Identifier: M20100211-1343

Formatting the following java source file

package fr.inist.refdoc.dtdNotice;

public class C {

	/**
	 * aaaa aaa aaa.<br>  
	 * {@link C}: aaaa.<br>
	 * {@link C}: aaaa.<br>
	 * aaa {@link C}: aaaa.<br>
	 * {@link C}: aaaa<br>
	 * {@link C}: aaaa.<br>
	 */
    public C() {
    }
}

is wrong. There is no new line after the <br> tag if it is followed by a {@link. The formatted source file is:
package fr.inist.refdoc.dtdNotice;

public class C {
	/**
	 * aaaa aaa aaa.<br> {@link C}: aaaa.<br> {@link C}: aaaa.<br>
	 * aaa {@link C}: aaaa.<br> {@link C}: aaaa<br> {@link C}: aaaa.<br>
	 */
	public C() {
	}
}

The only line break is after the <br> followed by aaa. I would have expected the format command to do nothing in this example.

 



Reproducible: Always

Steps to Reproduce:
1.Create a java class as:
package fr.inist.refdoc.dtdNotice;

public class C {
	/**
	 * aaaa aaa aaa.<br>  
	 * {@link C}: aaaa.<br>
	 * {@link C}: aaaa.<br>
	 * aaa {@link C}: aaaa.<br>
	 * {@link C}: aaaa<br>
	 * {@link C}: aaaa.<br>
	 */
    public C() {
    }
}

2. Format the source file.
Comment 1 Frederic Fusier CLA 2010-06-04 07:48:43 EDT
Reproduced using 3.6RC3.

Note that you have a simple workaround, put the lines inside a paragraph:

public class X02 {

	/**
	 * <p>
	 * aaaa aaa aaa.<br>
	 * {@link X02}: aaaa.<br>
	 * {@link X02}: aaaa.<br>
	 * aaa {@link X02}: aaaa.<br>
	 * {@link X02}: aaaa<br>
	 * {@link X02}: aaaa.<br>
	 * </p>
	 */
	public X02() {
	}
}

Then, the formatter will let the lines untouched as expected...
Comment 2 Ludovic WALLE CLA 2010-06-04 08:31:27 EDT
I didn't thought of that. I tried, and yes, formatting worked as I expected. 

But I won't apply it because I don't want to spend time doing that (manually) in all in my sources files, having to undo it once fixed, and not being sure that it works in all cases. As it is just an annoyance, I prefer doing nothing and wait for a real solution.
Comment 3 Frederic Fusier CLA 2010-06-23 09:50:52 EDT
Created attachment 172503 [details]
Proposed patch

Specifying that the formatter javadoc html tag needs to be followed by a new line was missing in some cases (typically when followed by a inline block).

This patch fixes this and the output will be correct now...
Comment 4 Frederic Fusier CLA 2010-06-23 10:02:29 EDT
(In reply to comment #3)
> Created an attachment (id=172503) [details]
> Proposed patch
> 
Released for 3.7M1 in HEAD stream.
Comment 5 Srikanth Sankaran CLA 2010-08-04 02:16:18 EDT
Verified for 3.7 M1 using build I20100802-1800