Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 169934 - [formatter] Removes blanks around comments in method declaration
Summary: [formatter] Removes blanks around comments in method declaration
Status: VERIFIED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.12 M3   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 220242 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-09 02:32 EST by Peter Arrenbrecht CLA
Modified: 2019-05-21 02:34 EDT (History)
5 users (show)

See Also:


Attachments
Proposed patch so people can check the regressions (4.27 KB, patch)
2007-07-09 16:40 EDT, Peter Arrenbrecht CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Arrenbrecht CLA 2007-01-09 02:32:58 EST
Build ID: I20061214-1445

Steps To Reproduce:
Try to format the following snippet:

public static interface CustomerData {
	public /**/OrderData[]/**/ ordersForLastNDays( int _days );
}

Eclipse removes the spaces around the /**/ comments. These comments may seem pointless, but they are highlighting markers for JCite (http://arrenbrecht.ch/jcite/).

More information:
As an alternative, bug 128630 would help me work around this problem.
Comment 1 Olivier Thomann CLA 2007-01-26 14:40:04 EST
If I had an option, I would be to remove whitespaces around comments everywhere and not just in the method declaration. Otherwise I will end up with an endless list of new options.
Comment 2 Peter Arrenbrecht CLA 2007-01-26 16:27:23 EST
(In reply to comment #1)
> If I had an option, I would be to remove whitespaces around comments everywhere
> and not just in the method declaration. Otherwise I will end up with an endless
> list of new options.

I don't think I fully understand what you mean. What option? Can you not just leave the whitespace alone there? Would that have to be an option? And what would be the point of removing all whitespace around comments? Would you then get "i = 3;// three" when you originally wrote "i = 3; // three"?
Comment 3 Peter Arrenbrecht CLA 2007-07-09 16:40:15 EDT
Created attachment 73389 [details]
Proposed patch so people can check the regressions

I am trying to fix this. My own test works nicely. But I get regressions where before "abstract /* */ class" would result in "abstract/* */class", but now in "abstract /* */class". Does anyone know if this matters? Or can it be changed? After all, right now "package /*...*/xy" is left as "package /*...*/xy" and not reformatted to "package/*...*/xy". So the current behaviour does not really look consistent to me anyway.

I have attached a first version of the proposed patch.
Comment 4 Frederic Fusier CLA 2008-05-26 09:59:35 EDT
*** Bug 220242 has been marked as a duplicate of this bug. ***
Comment 5 Frederic Fusier CLA 2009-02-24 04:54:57 EST
*** Bug 220242 has been marked as a duplicate of this bug. ***
Comment 6 Mateusz Matela CLA 2019-05-12 14:24:15 EDT
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 7 Jay Arthanareeswaran CLA 2019-05-21 02:34:45 EDT
Verified for 4.12 M3 using build I20190520-1805