code: private boolean isDescendant(DependencyInfo parentDependency, DependencyInfo childDependency){
          for (DependencyInfo dependencyInfo : childDependency.getChildren()){
              if (dependencyInfo.equals(parentDependency))
                  return true;
              return isDescendant(dependencyInfo, childDependency);
          }
          return false;
      }
docs: avoiding circular-dependencies