Bug 239130

Summary: [formatter] Comment formatter does not keep blank lines after @see references
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: benno.baumgartner, bugzilla, Olivier_Thomann
Version: 3.4   
Target Milestone: 3.5 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 198074    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch
none
Updated patch on top of fix for bug 256799
none
Last proposed patch none

Description Frederic Fusier CLA 2008-07-01 10:36:12 EDT
Using 3.4.0

Formatting the following simple test case:
public class X {

	/**
	 * @see java.lang.String
	 * 
	 * Formatter should keep empty line above
	 */
	void foo() {
	}
}

I get the following output:
public class X {

	/**
	 * @see java.lang.String Formatter should keep empty line above
	 */
	void foo() {
	}
}

Which is obviously incorrect. This output should only be produced if the 'Remove blank lines' preference was set in the 'Comment' tab...
Comment 1 Olivier Thomann CLA 2008-07-07 11:36:20 EDT
(In reply to comment #0)
> Which is obviously incorrect. This output should only be produced if the
> 'Remove blank lines' preference was set in the 'Comment' tab...
If this option is set, the output should be:
public class X {

        /**
         * @see java.lang.String
         * Formatter should keep empty line above
         */
        void foo() {
        }
} 

and not:
public class X {

        /**
         * @see java.lang.String Formatter should keep empty line above
         */
        void foo() {
        }
} 
Comment 2 Frederic Fusier CLA 2008-07-08 07:54:57 EDT
(In reply to comment #1)
Theoretically yes, but due to bug 96696 it would behave like I described (i.e. concatenating lines). Currently the formatter does not preserve existing line breaks, neither in comments (bug 96696) nor in code (bug 198074).

I think we need to think about a global solution which would solve all these bugs in one shot...
Comment 3 Frederic Fusier CLA 2008-12-03 07:13:37 EST
Created attachment 119368 [details]
Proposed patch

This patch also includes fix for bug 198074 as there's only one preference to preserve existing line break...
Comment 4 Frederic Fusier CLA 2008-12-03 07:16:28 EST
*** Bug 96696 has been marked as a duplicate of this bug. ***
Comment 5 Frederic Fusier CLA 2008-12-03 07:18:22 EST
*** Bug 196124 has been marked as a duplicate of this bug. ***
Comment 6 Frederic Fusier CLA 2008-12-04 06:30:17 EST
Created attachment 119490 [details]
Updated patch on top of fix for bug 256799
Comment 7 Frederic Fusier CLA 2008-12-04 11:31:33 EST
Created attachment 119523 [details]
Last proposed patch

This last patch includes an expected change in an existing test...
Comment 8 Frederic Fusier CLA 2008-12-04 11:39:48 EST
Released for 3.5M4 in HEAD stream.
Comment 9 Kent Johnson CLA 2008-12-09 14:01:16 EST
Verified for 3.5M4 using I20081209-0100