private static void tabulateDependencyPackages(RefEntity entity, Set<? super RefPackage> dependencies) {
    if (entity instanceof RefElement element) {
      final Collection<RefElement> references = element.getOutReferences();
      for (RefElement reference : references) {
        final RefPackage refPackage = RefJavaUtil.getPackage(reference);
        if (refPackage != null) {
          dependencies.add(refPackage);
        }
      }
    }
    final List<RefEntity> children = entity.getChildren();
    for (RefEntity child : children) {
      if (!(child instanceof RefPackage)) {
        tabulateDependencyPackages(child, dependencies);
      }
    }
  }
private static void tabulateDependencyPackages(RefEntity entity, Set<? super RefPackage> dependencies)