List<ProgressableTextEditorHighlightingPass> (@NotNull Document document) { List<HighlightingPass> allPasses = myPassExecutorService.getAllSubmittedPasses(); return allPasses.stream() .map(p->p instanceof ProgressableTextEditorHighlightingPass pPass ? pPass : null) .filter(p-> p != null && p.getDocument() == document) .sorted(Comparator.comparingInt(p->p.getId())) .collect(Collectors.toList()); }