in src/main/java/org/jetbrains/plugins/spotbugs/plugins/AbstractPluginLoaderLegacy.java [66:140]
public void load(final Collection<String> userPluginsUrls, final Collection<String> disabledUserPluginIds, final Collection<String> enabledBundledPluginIds, final Collection<String> disabledBundledPluginIds) {
PluginLoader.invalidate();
// 1. unload plugins
for (Plugin plugin : Plugin.getAllPlugins()) {
if (plugin.isCorePlugin()) {
seenCorePlugin(plugin);
} else {
FindBugsCustomPluginUtil.unload(plugin);
}
}
// 2. load bundled plugins and unload
final File[] bundledPlugins = Plugins.getDirectory(FindBugsPluginUtil.getIdeaPluginDescriptor()).listFiles();
final Set<String> enabledBundledPluginUrls = new HashSet<String>();
if (bundledPlugins != null) {
for (final File pluginFile : bundledPlugins) {
if (!pluginFile.getName().endsWith(".jar")) {
continue;
}
try {
if (FindBugsCustomPluginUtil.check(pluginFile)) {
Plugin plugin = FindBugsCustomPluginUtil.loadTemporary(pluginFile);
if (plugin == null) {
handleError("Could not load plugin: " + pluginFile.getPath());
continue;
}
seenBundledPlugin(plugin);
if (!disabledBundledPluginIds.contains(plugin.getPluginId()) && enabledBundledPluginIds.contains(plugin.getPluginId())) {
enabledBundledPluginUrls.add(FindBugsCustomPluginUtil.getAsString(plugin));
}
FindBugsCustomPluginUtil.unload(plugin);
} else {
handleError("Plugin '" + pluginFile.getPath() + "' not loaded. Archive inaccessible.");
}
} catch (final Throwable e) {
handleError("Could not load custom findbugs plugin: " + pluginFile.getPath(), e);
}
}
}
// 3. load user plugins and unload
final Set<String> enabledUserPluginUrls = new HashSet<String>();
for (final String pluginUrl : userPluginsUrls) {
try {
final File pluginFile = FindBugsCustomPluginUtil.getAsFile(pluginUrl);
if (FindBugsCustomPluginUtil.check(pluginFile)) {
final Plugin plugin = FindBugsCustomPluginUtil.loadTemporary(pluginUrl);
if (plugin == null) {
handleError("Could not load plugin: " + pluginUrl);
continue;
}
seenUserPlugin(pluginUrl, plugin);
if (!disabledUserPluginIds.contains(plugin.getPluginId())) {
enabledUserPluginUrls.add(pluginUrl);
}
FindBugsCustomPluginUtil.unload(plugin);
} else {
handleError("Plugin '" + pluginUrl + "' not loaded. Archive '" + pluginFile.getPath() + "' inaccessible or not exists.");
}
} catch (MalformedURLException e) {
handleError("Could not load plugin: " + pluginUrl, e);
} catch (PluginException e) {
handleError("Could not load plugin: " + pluginUrl, e);
}
}
// 4. load enabled plugins
loadPluginsPermanently(enabledBundledPluginUrls, false);
loadPluginsPermanently(enabledUserPluginUrls, true);
}