Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354324 - [typing] foreach statements that aren't followed by braced blocks mess up indentation
Summary: [typing] foreach statements that aren't followed by braced blocks mess up ind...
Status: CLOSED DUPLICATE of bug 348198
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 01:52 EDT by rezecib Mising name CLA
Modified: 2011-08-10 04:01 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rezecib Mising name CLA 2011-08-10 01:52:42 EDT
Build Identifier: I20110613-1736 

Indentation does not work properly after one-line (no-brace) foreach statements.
Example code:

public class Bork
{
	public static void method()
	{
		int sum = 0;
		int[][] grid = new int[9][9];
		
		for(int r = 0; r < 9; r++)
			for(int c = 0; c < 9; c++)
				sum++;
		sum = 0;
		
		for(int[] row : grid)
			for(int el : row)
				sum++;
					sum = 0;
	}
}

Reproducible: Always

Steps to Reproduce:
1.Write a foreach statement
2.Fill its block with only one statement, and don't use braces
3.Hit enter and type another statement
Comment 1 Dani Megert CLA 2011-08-10 04:01:05 EDT

*** This bug has been marked as a duplicate of bug 348198 ***