@NotNull @Unmodifiable
  static List<? extends Class<?>> getAcceptingPsiTypes(@NotNull PsiElementVisitor visitor) {
    if (!useOptimizedVisitors) return ALL_ELEMENTS_VISIT_LIST;

    List<? extends Class<?>> acceptingPsiTypes;
    if (visitor instanceof HintedPsiElementVisitor hinted) {
      acceptingPsiTypes = hinted.getHintPsiElements();

      if (inTests) {
        VisitorTypes handlesTypes = VISITOR_TYPES.get(visitor.getClass());
        if (!handlesTypes.overridesVisitPsiElement() && !handlesTypes.handlesElementTypes().equals(acceptingPsiTypes)) {
          LOG.error("HintedPsiElementVisitor implementations must override PsiElementVisitor.visitElement", visitor.getClass().getName());
        }
      }

      if (acceptingPsiTypes.contains(PsiElement.class) || acceptingPsiTypes.isEmpty()) {
        acceptingPsiTypes = ALL_ELEMENTS_VISIT_LIST;
      }
    }
    else {
      acceptingPsiTypes = VISITOR_TYPES.get(visitor.getClass()).handlesElementTypes();
    }

    return acceptingPsiTypes;
  }
@NotNull @Unmodifiable
  static List<? extends Class<?>> getAcceptingPsiTypes(@NotNull PsiElementVisitor visitor)