void () { configureByText(JavaFileType.INSTANCE, """ package x;\s class <caret>ToRun{ public static void main(String[] args) { } }"""); assertEmpty(highlightErrors()); List<LineMarkerInfo<?>> lineMarkers = DaemonCodeAnalyzerImpl.getLineMarkers(myEditor.getDocument(), getProject()); assertSize(2, lineMarkers); backspace(); Collection<String> changed = Collections.synchronizedList(new ArrayList<>()); MarkupModelEx modelEx = (MarkupModelEx)DocumentMarkupModel.forDocument(getDocument(getFile()), getProject(), true); modelEx.addMarkupModelListener(getTestRootDisposable(), new MarkupModelListener() { @Override public void afterAdded(@NotNull RangeHighlighterEx highlighter) { changed(highlighter, "after added"); } @Override public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) { changed(highlighter, "before removed"); } @Override public void attributesChanged(@NotNull RangeHighlighterEx highlighter, boolean renderersChanged, boolean fontStyleChanged) { changed(highlighter, "changed"); } private void changed(@NotNull RangeHighlighterEx highlighter, @NotNull String reason) { if (highlighter.getTargetArea() != HighlighterTargetArea.LINES_IN_RANGE) return; // not line marker List<LineMarkerInfo<?>> lineMarkers = DaemonCodeAnalyzerImpl.getLineMarkers(myEditor.getDocument(), getProject()); if (ContainerUtil.find(lineMarkers, lm -> lm.highlighter == highlighter) != null) { changed.add(highlighter + ": \n" + ExceptionUtil.getThrowableText(new Throwable(reason))); } // else not line marker } }); assertEmpty(highlightErrors()); UIUtil.dispatchAllInvocationEvents(); assertSize(2, DaemonCodeAnalyzerImpl.getLineMarkers(myEditor.getDocument(), getProject())); assertEmpty(changed); }