Bug 305281 - [formatter] Turning off formatting changes comment's formatting
Summary: [formatter] Turning off formatting changes comment's formatting
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.6 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-09 23:23 EST by Deepak Azad CLA
Modified: 2010-04-26 08:21 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (3.42 KB, patch)
2010-03-10 05:15 EST, 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 Deepak Azad CLA 2010-03-09 23:23:54 EST
-Start with following code snippet
package p;

public class test {

	/**
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		do {
			} while (false);
		for (;;) {
		}
		// format: ON
	}
}
- turn of formatting before main(..)
public class test {

	/**
	 * @param args
	 * format: OFF
	 */
	public static void main(String[] args) {
		do {

-Format the whole file to get the following - the comment in unformatted. I think turning off formatting should just leave the comment as it is.
package p;

public class test {

/**
	 * @param args
	 * format: OFF
	 */
	public static void main(String[] args) {
		do {
			} while (false);
		for (;;) {
		}
		// format: ON
	}
}
Comment 1 Frederic Fusier CLA 2010-03-10 05:15:50 EST
Created attachment 161591 [details]
Proposed patch

The new lines before disabling comment also need specific treatment before javadoc comments...
Comment 2 Frederic Fusier CLA 2010-03-10 06:42:53 EST
Olivier, although it's a minor defect, may be can we put its fix for 3.6M6?

The fix is definitely safe as the piece of added code is already used for line and block comments...
Comment 3 Olivier Thomann CLA 2010-03-10 10:46:49 EST
+1 as I want some stability in this new feature.
Comment 4 Olivier Thomann CLA 2010-03-10 12:00:11 EST
Tagging as 3.6M7. This is not critical and as is should not be released after the M6 test day.
Will be released once M6 is declared.
Comment 5 Frederic Fusier CLA 2010-03-11 06:45:49 EST
Released for 3.6M7 in HEAD stream.
Comment 6 Satyam Kandula CLA 2010-04-26 07:25:29 EDT
Verified for 3.6M7 using build I20100424-2000
Comment 7 Jay Arthanareeswaran CLA 2010-04-26 08:21:35 EDT
Verified.