public void compile(PsiElement @NotNull [] topLevelElements) {
    final CompileContext context = myCompilingVisitor.getContext();

    // When dumb the index is not used while editing pattern (e.g. no warning when zero hits in project).
    final JavaWordOptimizer optimizer = DumbService.isDumb(context.getProject()) ? null : new JavaWordOptimizer();
    final CompiledPattern pattern = context.getPattern();
    for (PsiElement element : topLevelElements) {
      element.accept(this);
      if (optimizer != null) element.accept(optimizer);
      pattern.setHandler(element, new TopLevelMatchingHandler(pattern.getHandler(element)));
    }
  }
public void compile(PsiElement @NotNull [] topLevelElements)