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
/**
	 * Checks whether code>document</code> contains the <code>String</code> <code>like</code> such 
	 * that its last character is at <code>position</code>. If <code>like</code> starts with a
	 * identifier part (as determined by {@link Character.isJavaIdentifier(char)}), it is also made
	 * sure that <code>like</code> is preceded by some non-identifier character or stands at the
	 * document start.
	 * 
	 * @param document the document being modified
	 * @param position the first character position in <code>document</code> to be considered
	 * @param like the <code>String</code> to look for.
	 * @return <code>true</code> if  <code>document</code> contains <code>like</code> such that it ends at <code>position</code>, <code>false</code> otherwise
	 */
	private static boolean looksLike(IDocument document, int position, String like) {
		int length= like.length();
		if (position < length - 1)
			return false;
		try {
			if (!like.equals(document.get(position - length + 1, length)))
				return false;
			if (position >= length && Character.isJavaIdentifierPart(like.charAt(0)) && Character.isJavaIdentifierPart(document.getChar(position - length)))
				return false;
		} catch (BadLocationException e) {
			return false;
		}
		return true;
	}
	/**
	 * Computes an insert position for an opening brace if <code>offset</code> maps to a position in
	 * <code>document</code> with a expression in parenthesis that will take a block after the closing parenthesis.
	 *