private static boolean errorChecks(@NotNull PsiElement method, @NotNull List<PsiElement> elementsToIgnore) {
    HighlightVisitor visitorImpl = ContainerUtil.find(HighlightVisitor.EP_HIGHLIGHT_VISITOR.getExtensionList(method.getProject()),
                                                      h -> h instanceof HighlightVisitorImpl);
    if (visitorImpl == null) return true;
    HighlightVisitor visitor = visitorImpl.clone();
    HighlightInfoHolder holder = new HighlightInfoHolder(method.getContainingFile());
    visitor.analyze(method.getContainingFile(), false, holder, () -> method.accept(new PsiRecursiveElementWalkingVisitor() {
      @Override
      public void visitElement(@NotNull PsiElement element) {
        if (elementsToIgnore.contains(element)) return; // ignore sub-elements too
        visitor.visit(element);
        //System.out.println("element = " + element+"; holder: "+holder.hasErrorResults());
        if (holder.hasErrorResults()) {
          stopWalking();
        }
        super.visitElement(element);
      }
    }));
    return !holder.hasErrorResults();
  }
private static boolean errorChecks(@NotNull PsiElement method, @NotNull List<PsiElement> elementsToIgnore)