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 document.getNumberOfLines(command.offset, command.length) > 1;
		} catch (BadLocationException e) {
			
			return false;
		}
	}
	/**
	 * Adds a space before a brace if it is inserted after a parenthesis, equal sign, or one
	 * of the keywords <code>try, else, do</code>. 
	 * 
	 * @param document the document we are working on
	 * @param position the insert position of <code>character</code>
	 * @param character the character to be inserted
	 * @return a <code>String</code> consisting of <code>character</code> plus any additional spacing
	 */
	private String adjustSpacing(IDocument doc, int position, char character) {
		if (character == BRACECHAR) {
			if (position > 0 && position <= doc.getLength()) {
				int pos= position - 1;
				if (looksLike(doc, pos, ")") 
				|| looksLike(doc, pos, "=") 
				|| looksLike(doc, pos, "]") 
				|| looksLike(doc, pos, "try") 
				|| looksLike(doc, pos, "else") 
				|| looksLike(doc, pos, "synchronized") 
				|| looksLike(doc, pos, "static") 
				|| looksLike(doc, pos, "finally") 
				|| looksLike(doc, pos, "do")) 
					return new String(new char[] { ' ', character });
			}