Bug 45349 [typing] Smart ; must replace selection
I20031015 1. enter "int a= 3;" 2. select "=3;" 3. press ";"
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/SmartSemicolonAutoEditStrategy.java
position= eatBrackets(document, position - 1, partitioning);
		if (position < 1)
			return false;
		
		position= eatIdentToLeft(document, position - 1, partitioning);
		return position != -1;
	}
	/**
	 * From <code>position</code> to the left, eats any whitespace and then a pair of brackets
	 * as used to declare an array return type like <pre>String [ ]</pre>.
	 * The return value is either the position of the opening bracket or <code>position</code> if no 
	 * pair of brackets can be parsed. 
	 * 
	 * @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 the smallest character position of bracket pair or <code>position</code>
	 */
	private static int eatBrackets(IDocument document, int position, String partitioning) {
		
		int pos= firstNonWhitespaceBackward(document, position, partitioning, -1);
		try {
			if (pos > 1 && document.getChar(pos) == ']') {
				pos= firstNonWhitespaceBackward(document, pos - 1, partitioning, -1);
				if (pos > 0 && document.getChar(pos) == '[')
					return pos;
			}
		} catch (BadLocationException e) {
			
		}