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
* @param offset the position of the caret
	 * @return <code>true</code> if <code>line</code> contains <code>for</code>, <code>false</code> otherwise
	 */
	private static boolean isForStatement(String line, int offset) {
		
		int forPos= line.indexOf("for"); 
		if (forPos != -1) {
			if ((forPos == 0 || !Character.isJavaIdentifierPart(line.charAt(forPos - 1))) && (line.length() == forPos + 3 || !Character.isJavaIdentifierPart(line.charAt(forPos + 3))))
				return true;
		}
		return false;
	}
	/**
	 * Returns the position in <code>text</code> after which there comes only whitespace, up to 
	 * <code>offset</code>.
	 *  
	 * @param text the text being searched
	 * @param offset the maximum offset to search for
	 * @return the smallest value <code>v</code> such that <code>text.substring(v, offset).trim() == 0</code>
	 */
	private static int startOfWhitespaceBeforeOffset(String text, int offset) {
		int i= Math.min(offset, text.length());
		for (; i >= 1; i--) {
			if (!Character.isWhitespace(text.charAt(i - 1)))
				break;
		}
		return i;
	}
}