Bug 297225 - [formatter] Indentation may be still wrong in certain circumstances after formatting
Summary: [formatter] Indentation may be still wrong in certain circumstances after for...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-08 11:06 EST by Frederic Fusier CLA
Modified: 2009-12-09 10:36 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch (10.95 KB, patch)
2009-12-08 11:28 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 Frederic Fusier CLA 2009-12-08 11:06:18 EST
Build I20091208-0100.

The indentation computed while formatting may be still wrong even after the fix for bug 293300 which solves most of invalid cases.

For instance, the following test case:
public class X {
   	
   	/**
   	 * The foo method
   	 */
	void foo() {}
}

is wrongly formatted as follow when all comments formatting is disabled:
public class X06 {

	/**
	* The foo method
	*/
	void foo() {
	}
}

This is due to an invalid guess of the indentation value when there's a mix of tab and spaces in the current comment indentation... This was partially fixed while fixing bug 293300, but apparently, there is still some problematic cases.
Comment 1 Frederic Fusier CLA 2009-12-08 11:28:11 EST
Created attachment 154025 [details]
Proposed patch

Verify all places where similar algorithm is used. Rename methods and variables as it's safer to compute the indentation and add 1 when the column is needed...
Comment 2 Frederic Fusier CLA 2009-12-08 17:16:35 EST
All JDT (Core/UI/Text) tests pass with the proposed patch and massive formatter tests only show improvements, hence I have released it for 3.6M4...
Comment 3 Olivier Thomann CLA 2009-12-08 20:44:27 EST
+1 for 3.6M4. We want the code formatter to be as stable as possible as soon as possible.
Comment 4 Satyam Kandula CLA 2009-12-09 08:24:19 EST
Verified for 3.6M4 using Build id:  I20091209-0100
Comment 5 Olivier Thomann CLA 2009-12-09 10:36:15 EST
Verified.