private static @NotNull List<SemElement> createSemElements(
    State keysAndProducers,
    SemKey<?> key, PsiElement psi, ProcessingContext processingContext
  ) {
    List<SemElement> result = null;

    var functions = keysAndProducers.producers.get(key);
    if (!functions.isEmpty()) {
      for (var producer : functions) {
        Collection<? extends SemElement> elements = producer.apply(psi, processingContext);
        if (elements != null && !elements.isEmpty()) {
          if (result == null) result = new SmartList<>();
          ContainerUtil.addAllNotNull(result, elements);
        }
      }
    }
    return result == null || result.isEmpty() ? emptyList() : result;
  }
private static @NotNull List<SemElement> createSemElements(
    State keysAndProducers,
    SemKey<?> key, PsiElement psi, ProcessingContext processingContext
  )