Bug 41906 [typing] Code assists handles anonymous inner classes less than optimal
Type the following code and press return at the indicated cursor position. addActionListener(new ActionListener() { <<<cursor_position>>> ) You get the following code: addActionListener(new ActionListener() { ) } The normal brace and the curly brace should really be exchanged.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
minIndentSize= indentSize;
		}
		return minIndentSize == Integer.MAX_VALUE ? 0 : minIndentSize;
	}
	/**
	 * Returns the displayed width of a string, taking in account the displayed tab width.
	 * The result can be compared against the print margin.
	 */
	private static int calculateDisplayedWidth(String string, int tabWidth) {
		int column= 0;
		for (int i= 0; i < string.length(); i++)
			if ('\t' == string.charAt(i))
				column += tabWidth - (column % tabWidth);
			else
				column++;
		return column;
	}
	private static boolean isLineEmpty(IDocument document, int line) throws BadLocationException {
		IRegion region= document.getLineInformation(line);
		String string= document.get(region.getOffset(), region.getLength());
		return string.trim().length() == 0;
	}
	private int getIndentSize(IDocument document, DocumentCommand command) {
		StringBuffer buffer= new StringBuffer();
		int docLength= document.getLength();
		if (command.offset == -1 || docLength == 0)
			return 0;
		try {
			
			int p= (command.offset == docLength ? command.offset - 1 : command.offset);