Commits

blablubbabc authored and md_5 committed 04df07fe9a4
#615: Calculate the reachable nodes only once per transitive dependency check.
No tags

src/main/java/org/bukkit/plugin/SimplePluginManager.java

Modified
838 838 @NotNull
839 839 public Set<Permission> getPermissions() {
840 840 return new HashSet<Permission>(permissions.values());
841 841 }
842 842
843 843 public boolean isTransitiveDepend(@NotNull PluginDescriptionFile plugin, @NotNull PluginDescriptionFile depend) {
844 844 Preconditions.checkArgument(plugin != null, "plugin");
845 845 Preconditions.checkArgument(depend != null, "depend");
846 846
847 847 if (dependencyGraph.nodes().contains(plugin.getName())) {
848 - if (Graphs.reachableNodes(dependencyGraph, plugin.getName()).contains(depend.getName())) {
848 + Set<String> reachableNodes = Graphs.reachableNodes(dependencyGraph, plugin.getName());
849 + if (reachableNodes.contains(depend.getName())) {
849 850 return true;
850 851 }
851 852 for (String provided : depend.getProvides()) {
852 - if (Graphs.reachableNodes(dependencyGraph, plugin.getName()).contains(provided)) {
853 + if (reachableNodes.contains(provided)) {
853 854 return true;
854 855 }
855 856 }
856 857 }
857 858 return false;
858 859 }
859 860
860 861 @Override
861 862 public boolean useTimings() {
862 863 return useTimings;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut