Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331734

Summary: [typing] Line indents too much on return
Product: [Eclipse Project] JDT Reporter: Eric Jain <eric.jain>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, deepakazad, Olivier_Thomann, rthakkar
Version: 3.7   
Target Milestone: 3.7 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Eric Jain CLA 2010-12-02 18:08:34 EST
Build Identifier:  I20101028-1441

Looks like this only happens after the first line of an else (or else if) block when the preceding else (or else if) block ends with a foreach block.

Reproducible: Always

Steps to Reproduce:
    public int sum(int... values) {
        int sum = 0;
        if (values != null) {
            for (int value : values) {
                sum += value;
            }
        }
        else {
            sum = -1; // hit return at the end of this line
        }
        return sum;
    }

-> the new line after 'sum = -1' is indented 5 instead of 3 levels
Comment 1 Eric Jain CLA 2010-12-02 18:10:43 EST
I can attach my code formatter settings if there is any problem reproducing the issue. Note that the formatter handles this code fine, the extra indentation appears only when hitting enter.
Comment 2 Olivier Thomann CLA 2010-12-02 19:29:25 EST
Moving to JDT/Text
Comment 3 Dani Megert CLA 2010-12-03 03:06:31 EST
I've reverted all recently made indent fixes.
Comment 4 Deepak Azad CLA 2010-12-07 08:18:45 EST
Verified for 3.7M4 with I20101206-1800.