Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331734 - [typing] Line indents too much on return
Summary: [typing] Line indents too much on return
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 18:08 EST by Eric Jain CLA
Modified: 2010-12-07 08:18 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.