#615: Calculate the reachable nodes only once per transitive dependency check.

By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
Bukkit/Spigot 2021-06-05 08:09:50 +10:00
parent c6409a81fd
commit 24bab712b3

View File

@ -845,11 +845,12 @@ public final class SimplePluginManager implements PluginManager {
Preconditions.checkArgument(depend != null, "depend");
if (dependencyGraph.nodes().contains(plugin.getName())) {
if (Graphs.reachableNodes(dependencyGraph, plugin.getName()).contains(depend.getName())) {
Set<String> reachableNodes = Graphs.reachableNodes(dependencyGraph, plugin.getName());
if (reachableNodes.contains(depend.getName())) {
return true;
}
for (String provided : depend.getProvides()) {
if (Graphs.reachableNodes(dependencyGraph, plugin.getName()).contains(provided)) {
if (reachableNodes.contains(provided)) {
return true;
}
}