void () { configureByText(JavaFileType.INSTANCE, """ package x; abstract class ToRun<TTTTTTTTTTTTTTT> implements Comparable<TTTTTTTTTTTTTTT> { private ToRun<TTTTTTTTTTTTTTT> delegate; <caret> \s }"""); assertEmpty(highlightErrors()); MarkupModelEx modelEx = (MarkupModelEx)DocumentMarkupModel.forDocument(getDocument(getFile()), getProject(), true); modelEx.addMarkupModelListener(getTestRootDisposable(), new MarkupModelListener() { @Override public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) { if (highlighter.getTextRange().substring(highlighter.getDocument().getText()).equals("TTTTTTTTTTTTTTT")) { throw new RuntimeException("Must not remove type parameter highlighter"); } } }); assertEmpty(highlightErrors()); type("//xxx"); assertEmpty(highlightErrors()); backspace(); assertEmpty(highlightErrors()); backspace(); assertEmpty(highlightErrors()); backspace(); assertEmpty(highlightErrors()); backspace(); backspace(); assertEmpty(highlightErrors()); }