Fix LegacyPluginLoader dependency registration (#9165)

This commit is contained in:
Owen1212055 2023-04-22 21:55:10 -04:00
parent 2da0966452
commit a4b55ff96a

View File

@ -1867,6 +1867,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.dependencies.contains(pluginIdentifier); + return this.dependencies.contains(pluginIdentifier);
+ } + }
+ +
+ // Used by the legacy loader -- this isn't recommended
+ public void addDirectDependency(String dependency) {
+ this.dependencies.add(dependency);
+ }
+
+ @Override + @Override
+ public String toString() { + public String toString() {
+ return "ProviderDependencyTree{" + + return "ProviderDependencyTree{" +
@ -2292,6 +2297,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ PluginMeta configuration = provider.getMeta(); + PluginMeta configuration = provider.getMeta();
+ +
+ PluginProvider<T> replacedProvider = providersToLoad.put(configuration.getName(), provider); + PluginProvider<T> replacedProvider = providersToLoad.put(configuration.getName(), provider);
+ dependencyTree.addDirectDependency(configuration.getName()); // add to dependency tree
+ if (replacedProvider != null) { + if (replacedProvider != null) {
+ LOGGER.severe(String.format( + LOGGER.severe(String.format(
+ "Ambiguous plugin name `%s' for files `%s' and `%s' in `%s'", + "Ambiguous plugin name `%s' for files `%s' and `%s' in `%s'",
@ -2324,6 +2330,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ )); + ));
+ } else { + } else {
+ String replacedPlugin = pluginsProvided.put(provided, configuration.getName()); + String replacedPlugin = pluginsProvided.put(provided, configuration.getName());
+ dependencyTree.addDirectDependency(provided); // add to dependency tree
+ if (replacedPlugin != null) { + if (replacedPlugin != null) {
+ LOGGER.warning(String.format( + LOGGER.warning(String.format(
+ "`%s' is provided by both `%s' and `%s'", + "`%s' is provided by both `%s' and `%s'",