| Summary: | [formatter] Code formatter destroys pre formatted javadoc comments | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Hansgeorg Schwibbe <hansgeorg.schwibbe> | ||||||
| Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | daniel_megert, Olivier_Thomann, philippe_mulet, remy.suen | ||||||
| Version: | 3.4 | Flags: | philippe_mulet:
pmc_approved+
|
||||||
| Target Milestone: | 3.4.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
I'll investigate... The problem comes from the @Override tag inside the code snippet... The FormatterCommentParser read it as a javadoc tag and stops the HTML tag <pre> just before!
Until a fix is released for this issue, the simple workaround is either to remove this tag or use the HTML character value for the '@' (@):
/**
* <pre>
* public class Test implements Runnable
* {
* @Override
* public void run()
* {
* // Hello really bad Ganymede formatter !!!
* // Shit happens when somebody tries to change a running system
* System.out.println("Press Shift+Ctrl+F to format");
* }
* }</pre>
*/
public class Test
{
}
will be then correctly formatted as:
/**
* <pre>
* public class Test implements Runnable {
* @Override
* public void run() {
* // Hello really bad Ganymede formatter !!!
* // Shit happens when somebody tries to change a running system
* System.out.println("Press Shift+Ctrl+F to format");
* }
* }
* </pre>
*/
public class Test {
}
Editing all @override tags in all projects is too much work for me, I jump back to Europa and wait for a stable Ganymede. Created attachment 106803 [details]
Proposed patch
The FormatterCommentParser now does not create tag when an html <pre> tag is currently opened...
Released for 3.5M1 (In reply to comment #3) > Editing all @override tags in all projects is too much work for me, > I jump back to Europa and wait for a stable Ganymede. > Have you so many @Override tags inside <pre>...</pre> in javadoc comments? Philippe, would it be OK to backport the fix for this bug to 3.4.1? +1 for 3.4.1 Created attachment 106845 [details]
Proposed patch for R3_4_maintenance stream
Released for 3.4.1 > Have you so many @Override tags inside <pre>...</pre> in javadoc comments?
Yes, I build my javadoc with many code examples.
(In reply to comment #11) > > Have you so many @Override tags inside <pre>...</pre> in javadoc comments? > Yes, I build my javadoc with many code examples. > OK, so as the fix has been released in maintenance build M20080709-0800, you can install it + Ganymede on top of it. This should give you the opportunity to see that the formatter is now 25% faster than the Europa one and also may be report other issues we are not currently aware of... Verified for 3.5M1 using I20080805-1307 Reopen to close as RESOLVED/FIXED. Will be closed as VERIFIED during 3.4.1 verification pass. Fixed. In fact @Override is replaced with @Override if code snippet is formatted. Verified for 3.4.1 using M20080827-2000. |
When I try to format the following code with Shift+Ctrl+F, the <pre> formatted code will be damaged: /** * <pre> * public class Test implements Runnable * { * @Override * public void run() * { * // Hello really bad Ganymede formatter !!! * // Shit happens when somebody tries to change a running system * System.out.println("Press Shift+Ctrl+F to format"); * } * }</pre> */ public class Test { } The result is the following: /** * <pre> * public class Test implements Runnable * { * * @Override public void run() { // Hello really bad Ganymede formatter !!! // * Shit happens when somebody tries to change a running system * System.out.println("Press Shift+Ctrl+F to format"); } } * * </pre> */ public class Test { }