void () { createRemoveCheck( () -> createMarker("xxxxx", 1, 3), RangeMarker::dispose); createRemoveCheck( () -> createMarker("xxxxx", 2, 3), marker -> ((DocumentEx)marker.getDocument()).removeRangeMarker((RangeMarkerEx)marker)); createRemoveCheck( () -> DocumentMarkupModel.forDocument(document, getProject(), true).addRangeHighlighter(2, 4, 0, null, HighlighterTargetArea.EXACT_RANGE), highlighter -> highlighter.dispose()); createRemoveCheck( () -> DocumentMarkupModel.forDocument(document, getProject(), true).addRangeHighlighter(2, 4, 0, null, HighlighterTargetArea.EXACT_RANGE), highlighter -> DocumentMarkupModel.forDocument(document, getProject(), true).removeHighlighter((RangeHighlighter)highlighter)); createRemoveCheck( () -> { VirtualFile virtualFile = createFile("x.txt", "xxx").getVirtualFile(); return LazyRangeMarkerFactory.getInstance(getProject()).createRangeMarker(virtualFile, 2); }, RangeMarker::dispose); createRemoveCheck( () -> { VirtualFile virtualFile = createFile("x.txt", "xxx").getVirtualFile(); return LazyRangeMarkerFactory.getInstance(getProject()).createRangeMarker(virtualFile, 2); }, marker -> { gcDocument(); marker.dispose(); }); }