Bug 108312 [typing] Smart semicolong option should support anonymizing a class
1) Place the caret between the closing parenthesis ')' and semicolon ';'. 2) Type an open brace '{'. 3) Type Enter key (carriage return). See that closing brace '}' is automatically added, but semicolon ';' is illegally misplaced. ----------------- Bug.java ------------------------ class Bug { Object object=new Object(); }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
if (indLine != -1 && indLine != line) {
					
					StringBuffer replaceText= new StringBuffer(getIndentOfLine(d, indLine));
					
					replaceText.append(d.get(whiteend, c.offset - whiteend));
					replaceText.append(c.text);
					
					c.length += c.offset - start;
					c.offset= start;
					c.text= replaceText.toString();
				}
			}
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
	}
	private void smartIndentAfterOpeningBracket(IDocument d, DocumentCommand c) {
		if (c.offset < 1 || d.getLength() == 0)
			return;
		JavaHeuristicScanner scanner= new JavaHeuristicScanner(d);
		int p= (c.offset == d.getLength() ? c.offset - 1 : c.offset);
		try {
			
			int line= d.getLineOfOffset(p);
			int lineOffset= d.getLineOffset(line);
			
			if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
				return;
			
			int pos= scanner.findNonWhitespaceBackward(p, JavaHeuristicScanner.UNBOUND);