public final <T> T withGreenStubTreeOrAst(
    Function<StubTree, T> stubProcessor,
    Function<FileElement, T> astProcessor
  ) {
    Pair<@Nullable StubTree, @Nullable FileElement> result = getStubTreeOrFileElement();
    if (result.first != null) {
      return stubProcessor.apply(result.first);
    }
    FileElement fileElement = result.second;
    if (fileElement == null) {
      fileElement = calcTreeElement();
    }
    return astProcessor.apply(fileElement);
  }
public final <T> T withGreenStubTreeOrAst(
    Function<StubTree, T> stubProcessor,
    Function<FileElement, T> astProcessor
  )