Bug 42279 unwanted indents after if()/for()/while()....
Since 3.0m3 (and one or two integration builds before it) i get an automatic indent after controll statements like if()+new line. So my code looks like this (only automatic indents): public class Main { void someMethod() { if(true) { // this doesn't look good } else if(1==1) { // this is getting even worse } // oh my god :( } } After running the code formater the code looks like expected public class Main { void someMethod() { if (true) { // this doesn't look good } else if (1 == 1) { // this is getting even worse } // oh my god :( } } If there is a switch i didn't didn't find: sorry. If not: please fix it asap
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
final char OPENING_PAREN= '(';
		Assert.isTrue(position < document.getLength());
		Assert.isTrue(position >= 0);
		Assert.isTrue(isDefaultPartition(document, position, partitioning));
		try {
			Assert.isTrue(document.getChar(position) == CLOSING_PAREN);
			
			int depth= 1;
			while (true) {
				position= scanBackward(document, position - 1, partitioning, -1, new char[] {CLOSING_PAREN, OPENING_PAREN});
				if (position == -1)
					return -1;
					
				if (document.getChar(position) == CLOSING_PAREN)
					depth++;
				else
					depth--;
				
				if (depth == 0)
					return position;
			}
		} catch (BadLocationException e) {
			return -1;
		}
	}
	/**
	 * Finds the highest position in <code>document</code> such that the position is &lt;= <code>position</code>
	 * and &gt; <code>bound</code> and <code>document.getChar(position) == ch</code> evaluates to <code>true</code> for at least one
	 * ch in <code>chars</code> and the position is in the default partition.   
	 *