Bug 145544 - Comment indentation wrong when using sun conventions
Summary: Comment indentation wrong when using sun conventions
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.3 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 165337 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-06 10:41 EDT by Tom Hofmann CLA
Modified: 2006-11-23 13:17 EST (History)
1 user (show)

See Also:


Attachments
org.eclipse.jdt.core.diff (4.38 KB, patch)
2006-06-06 10:46 EDT, Tom Hofmann CLA
no flags Details | Diff
org.eclipse.jdt.core.diff (4.38 KB, patch)
2006-06-09 04:41 EDT, Tom Hofmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2006-06-06 10:41:40 EDT
3.2 RC7

- use Sun's coding conventions
- have the CU below (. == space, --> == tab)

------------ Format.java --------
package a;

class Format {
..../**
.... * Type comment
.... */
....class Inner {
------->/**
-------> * Member comment
-------> */
------->int field;
....}
}
-----------------------------------

- format it

> expected: type comment indented with 4 spaces, member comment with 1 tab (unchanged from above).

< actual: 

------------ Format.java --------
package a;

class Format {
..../**
........ * Type comment
........ */
....class Inner {
------->/**
........ * Member comment
........ */
------->int field;
....}
}
-----------------------------------


Part of the problem is in JDT-text land, but org.eclipse.jdt.internal.formatter.comment.CommentRegion also needs an update. I will attach a patch.
Comment 1 Tom Hofmann CLA 2006-06-06 10:46:50 EDT
Created attachment 43592 [details]
org.eclipse.jdt.core.diff

Corrects computeIndentation. The ctor change takes into account that the visual tab size is stored in the INDENTATION_SIZE preference when the indent char is SPACE. 

I also removed an unused parameter and removed some duplicate code - feel free to ignore.
Comment 2 Tom Hofmann CLA 2006-06-09 04:41:56 EDT
Created attachment 43963 [details]
org.eclipse.jdt.core.diff

Correction of the previous patch - when indenting with spaces, the created indent must of course not use tabs...
Comment 3 Olivier Thomann CLA 2006-06-21 14:43:58 EDT
Fixed and released in HEAD.
Regression test added in org.eclipse.jdt.core.tests.formatter.comment.MultiLineTestCase.testMultiLineCommentFor145544
Comment 4 Frederic Fusier CLA 2006-08-03 08:46:18 EDT
Released for 3.3 M1
Comment 5 Frederic Fusier CLA 2006-08-08 04:00:33 EDT
Verified for 3.3 M1 using build I20060807-2000.
Comment 6 Olivier Thomann CLA 2006-11-23 13:17:37 EST
*** Bug 165337 has been marked as a duplicate of this bug. ***