Bug 40038 [typing] Smart semicolon fooled by method braces
Build: I20030710 Start writing a setter method, like this: public void setValue(int i) {} Then position cursor between the braces and fill in the method body. You end up with this: public void setValue(int i) {this.value=i}; Problem: when you type the semicolon, it jumps over the closing method body brace and places it at the end of the line, resulting in a syntax error.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/SmartSemicolonAutoEditStrategy.java
private static int findClosingParenToLeft(IDocument document, int position, String partitioning) {
		final char CLOSING_PAREN= ')';
		try {
			if (position < 1)
				return position;
			int nonWS= firstNonWhitespaceBackward(document, position - 1, partitioning, -1);
			if (nonWS != -1 && document.getChar(nonWS) == CLOSING_PAREN)
				return nonWS;
		} catch (BadLocationException e1) {
		}
		return position;
	}
	/**
	 * Finds the first whitespace character position to the right of (and including) <code>position</code>.
	 * 
	 * @param document the document being modified
	 * @param position the first character position in <code>document</code> to be considered
	 * @return the position of a whitespace character greater or equal than <code>position</code> separated only by whitespace, or -1 if none found
	 */
	private static int firstWhitespaceToRight(IDocument document, int position) {
		int length= document.getLength();
		Assert.isTrue(position >= 0);
		Assert.isTrue(position <= length);
		try {
			while (position < length) {
				char ch= document.getChar(position);
				if (Character.isWhitespace(ch))
					return position;
				position++;
			}