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/SmartSemicolonAutoEditStrategy.java
/**
	 * Checks whether, to the left of <code>position</code> and separated only by whitespace,
	 * <code>document</code> contains a keyword taking a parameter list and a block after it.
	 * These are: <code>if</code>, <code>while</code>, <code>catch</code>, <code>for</code>, <code>synchronized</code>, <code>switch</code>.
	 *
	 * @param document the document being modified
	 * @param position the first character position in <code>document</code> to be considered
	 * @param partitioning the document partitioning
	 * @return <code>true</code> if <code>document</code> contains any of the above keywords to the left of <code>position</code>, <code>false</code> otherwise
	 */
	private static boolean looksLikeIfWhileForCatch(IDocument document, int position, String partitioning) {
		position= firstNonWhitespaceBackward(document, position, partitioning, -1);
		if (position == -1)
			return false;
		return looksLike(document, position, "if") 
				|| looksLike(document, position, "while") 
				|| looksLike(document, position, "catch") 
				|| looksLike(document, position, "synchronized") 
				|| looksLike(document, position, "switch") 
				|| looksLike(document, position, "for"); 
	}
	/**
	 * 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#isJavaIdentifierPart(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