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

Bug 348198

Summary: [1.7][typing] Broken indentation after enhanced for loop
Product: [Eclipse Project] JDT Reporter: Ulrich Hobelmann <ulrich.hobelmann>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, daniel_megert, deepakazad, grajcar1, rezecib
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix with additional test none

Description Ulrich Hobelmann CLA 2011-06-03 08:29:32 EDT
Build Identifier: 20110526-1053

After an enhanced for-loop with a single statement, the next line is indented wrong:

for (Integer id : ids)
    process(id);
        int nextLine;

Also see Bug 331028, as it may be related.

Reproducible: Always

Steps to Reproduce:
1. Type the two-line for loop
2. Enter another line, Press Ctrl-I to indent.
3. Not profit.
Comment 1 Dani Megert CLA 2011-06-06 08:45:35 EDT
Created attachment 197391 [details]
Fix with additional test
Comment 2 Deepak Azad CLA 2011-06-22 01:04:44 EDT
Committed to BETA_JAVA7 branch.
Comment 3 Martin Grajcar CLA 2011-07-14 20:37:56 EDT
It doesn't affect only the next line, but all following lines (until a closing brace). It also affects lines after a single-line loop like

for (Integer id : ids) process(id);
    int nextLine;
    int nextLine2;

It also happens during Save Actions, thus making version control unusable.
Comment 4 Deepak Azad CLA 2011-07-14 22:38:45 EDT
.
Comment 5 Dani Megert CLA 2011-07-15 02:23:25 EDT
Adding [1.7] so we find it easier. All fixed [1.7] bugs in BETA_JAVA7 will go into 3.7.1.
Comment 6 Ayushman Jain CLA 2011-07-20 04:30:24 EDT
Verified using JDT feature patch v20110714-1300.
Comment 7 Dani Megert CLA 2011-08-10 04:01:05 EDT
*** Bug 354324 has been marked as a duplicate of this bug. ***