Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348198 - [1.7][typing] Broken indentation after enhanced for loop
Summary: [1.7][typing] Broken indentation after enhanced for loop
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 3.7.1   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 354324 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-03 08:29 EDT by Ulrich Hobelmann CLA
Modified: 2011-08-10 04:01 EDT (History)
5 users (show)

See Also:


Attachments
Fix with additional test (2.75 KB, patch)
2011-06-06 08:45 EDT, Dani Megert CLA
no flags Details | Diff

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