Bug 47986 - Formatting of 'for' initializers
Summary: Formatting of 'for' initializers
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-03 10:53 EST by Silvio Böhler CLA
Modified: 2003-12-17 06:26 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Silvio Böhler CLA 2003-12-03 10:53:37 EST
I200312020950

INSERT_SPACE_BEFORE/AFTER_COMMA_IN_FOR_INITS don't affect the formatting of
commas in the initializer of a for loop. Instead, this is determined by 
INSERT_SPACE_BEFORE/AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS.

Example:

class Example
{

    void foo() {
        for ( int i = 0,j = 100; i < 10; i++, j-- ) {
                  ^^^^^^^^^^^^^^^
            Other.enable(i, j);
        }
    }
}
Comment 1 Olivier Thomann CLA 2003-12-03 11:09:00 EST
I will investigate.
Comment 2 Olivier Thomann CLA 2003-12-03 11:14:58 EST
I don't think I can fix this without introducing duplicate codes in the
formatter and I really don't want this. The option
INSERT_SPACE_BEFORE/AFTER_COMMA_IN_FOR_INITS was in fact never used, because it
is already handled by the
INSERT_SPACE_BEFORE/AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS. This is
problematic since the new ui is using both options.
I will clean up the code to see what I can do in this case.
Comment 3 Olivier Thomann CLA 2003-12-03 12:06:46 EST
This is inconsistent with the case where method invocations are used for the for
initializers. Need to be fixed.
Comment 4 Olivier Thomann CLA 2003-12-03 12:34:59 EST
Fixed and released in HEAD.
Regression tests added.
Comment 5 David Audel CLA 2003-12-17 06:26:11 EST
Verified for 3.0M6