Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 220242 - [formatter] should not remove all whitespace after block comment
Summary: [formatter] should not remove all whitespace after block comment
Status: CLOSED DUPLICATE of bug 169934
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 4.12 M3   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 13:07 EST by Markus Keller CLA
Modified: 2019-05-12 14:38 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2008-02-25 13:07:16 EST
I20080222-1622

Format this field declaration with block comment formatting disabled:
	private List/*<RefactoringParticipant>*/ fParticipants;

=> result:
	private List/*<RefactoringParticipant>*/fParticipants;

=> expected: Should leave as is, i.e. not remove the space between (type&comment) and field name.
Comment 1 Eric Jodet CLA 2008-02-26 01:09:36 EST
(In reply to comment #0)
Markus,
as I understand it, when you disable the comment block formatting option, this means than anything INSIDE a block comment should NOT be formatted.

In the sample you provided:
private List/*<RefactoringParticipant>*/ fParticipants;

the blank between the comment and the field name is OUTSIDE the block comment.

If, for example, you had some blanks inside the block comment, they won't be formatted (with the comment block formatting option disabled).

So I consider the formatter behaves OK and would close as invalid.
Comment 2 Markus Keller CLA 2008-02-26 04:34:24 EST
Sorry, I was not too clear. I agree that the block comment formatting option should not affect the whitespace outside of the block. I just mentioned that option to avoid confusion inside the comment, because enabling the option results in:
	private List/* <RefactoringParticipant> */fParticipants;

In both cases, I think it would be better to leave a (single) space between field type and field name, regardless of the presence of a comment. AFAIK, the user cannot control that behavior (e.g. two spaces or a tab are always compacted into one space).

It looks like the formatter currently preserves a space *before* the comment, e.g.
	private List  /*<RefactoringParticipant>*/  fParticipants;
is formatted to:
	private List /*<RefactoringParticipant>*/fParticipants;

I think we don't need an option for this. Just preserve a single space after the comment (if any space was there before). I don't care about space before the comment here, but I guess keep preserving it there too would suit everyone's needs.

We use these "poor man's generics" quite often to make code with collections readable.
Comment 3 Eric Jodet CLA 2008-02-26 04:57:05 EST
(In reply to comment #2)
Thanks for the details.
I agree there should a way to preserve / insert a space after this comment
Comment 4 Frederic Fusier CLA 2008-05-26 09:59:35 EDT

*** This bug has been marked as a duplicate of bug 169934 ***
Comment 5 Frederic Fusier CLA 2009-02-24 04:54:13 EST
Reopen to reassign...
Comment 6 Frederic Fusier CLA 2009-02-24 04:54:57 EST

*** This bug has been marked as a duplicate of bug 169934 ***
Comment 7 Mateusz Matela CLA 2019-05-12 14:38:01 EDT
closing with bug 169934