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
* @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;
	}
	/**
	 * Checks whether the content of <code>document</code> at <code>position</code> looks like a
	 * method declaration header (i.e. only the return type and method name). <code>position</code>
	 * must be just left of the opening parenthesis of the parameter list.
	 *
	 * @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 the content of <code>document</code> looks like a method definition, <code>false</code> otherwise
	 */
	private static boolean looksLikeMethodDecl(IDocument document, int position, String partitioning) {
		
		position= eatIdentToLeft(document, position, partitioning);