Bug 238090 - [formatter] New lines wrongly added while formatting too long @see references
Summary: [formatter] New lines wrongly added while formatting too long @see references
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 239605 (view as bug list)
Depends on:
Blocks: 233259
  Show dependency tree
 
Reported: 2008-06-23 06:21 EDT by Frederic Fusier CLA
Modified: 2008-08-28 12:30 EDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (2.50 KB, patch)
2008-06-23 06:35 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 Frederic Fusier CLA 2008-06-23 06:21:04 EDT
Using 3.4.0 candidate (I20080617-2000).

While working on bug 233259 fix, I discovered a glitch in method printJavadocBlockReference(FormatJavadocBlock, FormatjavadocReference) of Scribe...

Consider the following test case:
package test.bugs;

public class LongNameClass {

/**
 * @see test.bugs.
 * LongNameClass#longNameMethod(java.lang.String)
 */
public void foo() {
}

void longNameMethod(String str) {
}
}

The format output using Eclipse built-in profile + 'Max line width for comments'=40 is:
package test.bugs;

public class LongNameClass {

	/**
	 * @see test.bugs.
	 *     
	 *     
	 *     
	 *     
	 *     
	 *     
	 *     
	 *      LongNameClass#longNameMethod(java.lang.String)
	 */
	public void foo() {
	}

	void longNameMethod(String str) {
	}
}

I would expect no change in fact, instead 7 new empty lines are wrongly added between the first and second line of the reference...
Comment 1 Frederic Fusier CLA 2008-06-23 06:27:43 EDT
The comment formatter behavior is definitely weird in this case and should be fixed for 3.4.1.
Comment 2 Frederic Fusier CLA 2008-06-23 06:35:52 EDT
Created attachment 105620 [details]
Proposed patch

The space position needed to be reset when a new line was inserted...
Comment 3 Frederic Fusier CLA 2008-06-24 09:17:29 EDT
Released for 3.5M1 in HEAD stream.
Comment 4 Jerome Lanneluc CLA 2008-06-25 07:11:46 EDT
+1 for backport to 3.4.1 as this a regression comparing to 3.3.2
Comment 5 Frederic Fusier CLA 2008-06-25 07:15:45 EDT
Released for 3.4.1
Comment 6 Olivier Thomann CLA 2008-08-06 12:26:18 EDT
Verified for 3.5M1 using I20080805-1307
Comment 7 Olivier Thomann CLA 2008-08-06 13:27:18 EDT
Reopen to close as RESOLVED/FIXED. Will be closed as VERIFIED during 3.4.1
verification pass.
Comment 8 Olivier Thomann CLA 2008-08-06 13:27:52 EDT
Fixed.
Comment 9 Frederic Fusier CLA 2008-08-20 12:04:12 EDT
*** Bug 239605 has been marked as a duplicate of this bug. ***
Comment 10 Olivier Thomann CLA 2008-08-28 12:30:19 EDT
Verified for 3.4.1 using M20080827-2000