code: private static int eval(
              @NonNull Class<? extends MarkwonPlugin> who,
              @NonNull Class<? extends MarkwonPlugin> plugin,
              @NonNull Map<Class<? extends MarkwonPlugin>, Set<Class<? extends MarkwonPlugin>>> map) {
  
          // exact match
          Set<Class<? extends MarkwonPlugin>> set = map.get(plugin);
  
          if (set == null) {
  
              // let's try to find inexact type (overridden/subclassed)
              for (Map.Entry<Class<? extends MarkwonPlugin>, Set<Class<? extends MarkwonPlugin>>> entry : map.entrySet()) {
                  if (plugin.isAssignableFrom(entry.getKey())) {
                      set = entry.getValue();
                      break;
                  }
              }
  
              if (set == null) {
                  // unsatisfied dependency
                  throw new IllegalStateException(String.format("Markwon unsatisfied dependency found. " +
                                  "Plugin `%s` comes after `%s` but it is not added.",
                          who.getName(), plugin.getName()));
              }
          }
  
          if (set.isEmpty()) {
              return 0;
          }
  
          int value = 1;
  
          for (Class<? extends MarkwonPlugin> dependency : set) {
  
              // a case when a plugin defines `Priority.after(getClass)` or being
              // referenced by own dependency (even indirect)
              if (who.equals(dependency)) {
                  throw new IllegalStateException(String.format("Markwon plugin `%s` defined self " +
                          "as a dependency or being referenced by own dependency (cycle)", who.getName()));
              }
  
              value += eval(who, dependency, map);
          }
  
          return value;
      }
docs: we need to count the number of steps to a root node (which has no parents)