Bug 49945 Typing a brace destroys subsequent character
I20040106 + plugin-export 20040108_1804 Typing a brace destroys the subsequent '/' character: public class Example { public Example() { } // <- insert '{' before comment public static void main(String[] args) { } } All Preferences 'Java > Editor > Typing' have the default setting.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
return;
			
		JavaHeuristicScanner scanner= new JavaHeuristicScanner(d);
		int p= (c.offset == d.getLength() ? c.offset - 1 : c.offset);
		
		try {
			
			int line= d.getLineOfOffset(p);
			int lineOffset= d.getLineOffset(line);
			
			
			int pos= scanner.findNonWhitespaceBackward(p, JavaHeuristicScanner.UNBOUND);
			if (pos == -1)
				return;
			int lastLine= d.getLineOfOffset(pos);
			
			
			if (lastLine < line) {
			
				JavaIndenter indenter= new JavaIndenter(d, scanner);
				StringBuffer indent= indenter.computeIndentation(p, true);
				if (indent != null) {
					c.text= indent.append(c.text).toString();
					c.length= indent.length();
					c.offset= lineOffset;
				}
			}
			
		} catch (BadLocationException e) {
			JavaPlugin.log(e);