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
if (IJavaPartitions.JAVA_DOC.equals(partition.getType()))
			return INVALID;
		if (IJavaPartitions.JAVA_MULTI_LINE_COMMENT.equals(partition.getType()))
			return INVALID;
		if (IJavaPartitions.JAVA_SINGLE_LINE_COMMENT.equals(partition.getType()))
			return INVALID;
		int endOffset= Math.min(maxOffset, partition.getOffset() + partition.getLength());
		if (IJavaPartitions.JAVA_CHARACTER.equals(partition.getType()))
			return endOffset;
		if (IJavaPartitions.JAVA_STRING.equals(partition.getType()))
			return endOffset;
		if (IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())) {
			try {
				if (doc.get(partition.getOffset(), endOffset - partition.getOffset()).trim().length() == 0)
					return INVALID;
				else
					return endOffset;
			} catch (BadLocationException e) {
				return INVALID;
			}
		}
		
		return endOffset;
	}
	/**
	 * Determines whether the current line contains a for statement.
	 * Algorithm: any "for" word in the line is a positive, "for" contained in a string literal will
	 * produce a false positive.
	 *
	 * @param line the line where the change is being made