void (InferenceSession session, Set<? extends InferenceVariable> dependencies, Set<? super InferenceVariable> rootDependencies) { final LinkedHashSet<InferenceVariable> newDependencies = new LinkedHashSet<>(); for (InferenceVariable dependency : dependencies) { dependency.collectBoundDependencies(session, newDependencies); } newDependencies.removeAll(rootDependencies); newDependencies.remove(this); if (!newDependencies.isEmpty()) { rootDependencies.addAll(newDependencies); collectTransitiveDependencies(session, newDependencies, rootDependencies); } }