Bug 108312 [typing] Smart semicolong option should support anonymizing a class
1) Place the caret between the closing parenthesis ')' and semicolon ';'. 2) Type an open brace '{'. 3) Type Enter key (carriage return). See that closing brace '}' is automatically added, but semicolon ';' is illegally misplaced. ----------------- Bug.java ------------------------ class Bug { Object object=new Object(); }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/SmartSemicolonAutoEditStrategy.java
if (position < pos)
			return;
		
		if (alreadyPresent(document, fCharacter, position))
			return;
		
		String insertion= adjustSpacing(document, position, fCharacter);
		if (command.offset == position && insertion.equals(command.text))
			return;
		try {
			final SmartBackspaceManager manager= (SmartBackspaceManager) editor.getAdapter(SmartBackspaceManager.class);
			if (manager != null && JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_BACKSPACE)) {
				TextEdit e1= new ReplaceEdit(command.offset, command.text.length(), document.get(command.offset, command.length));
				UndoSpec s1= new UndoSpec(command.offset + command.text.length(),
						new Region(command.offset, 0),
						new TextEdit[] {e1},
						0,
						null);
				DeleteEdit smart= new DeleteEdit(position, insertion.length());
				ReplaceEdit raw= new ReplaceEdit(command.offset, command.length, command.text);
				UndoSpec s2= new UndoSpec(position + insertion.length(),
						new Region(command.offset + command.text.length(), 0),
						new TextEdit[] {smart, raw},
						2,
						s1);
				manager.register(s2);
			}
			
			command.offset= position;