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
}
		return new String(new char[] { character });
	}
	/**
	 * Checks whether a character to be inserted is already present at the insert location (perhaps
	 * separated by some whitespace from <code>position</code>.
	 * 
	 * @param document the document we are working on
	 * @param position the insert position of <code>ch</code>
	 * @param character the character to be inserted
	 * @return <code>true</code> if <code>ch</code> is already present at <code>location</code>, <code>false</code> otherwise
	 */
	private boolean alreadyPresent(IDocument document, char ch, int position) {
		int pos= firstNonWhitespaceForward(document, position, fPartitioning, document.getLength());
		try {
			if (pos != -1 && document.getChar(pos) == ch)
				return true;
		} catch (BadLocationException e) {
		}
		return false;
	}
	/**
	 * Computes the next insert position of the given character in the current line.
	 * 
	 * @param document the document we are working on
	 * @param line the line where the change is being made
	 * @param offset the position of the caret in the line when <code>character</code> was typed
	 * @param character the character to look for
	 * @param partitioning the document partitioning
	 * @return the position where <code>character</code> should be inserted / replaced