Bug 47986

Summary: Formatting of 'for' initializers
Product: [Eclipse Project] JDT Reporter: Silvio Böhler <silvio_boehler>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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