PluginLoader { public boolean canLoad(Plugin plugin) { return plugin != null && PluginLoaderHelper.getRequirements(plugin.getClass()).stream() .allMatch(a -> loadedPlugins.stream() .filter(p -> p.getGroupId().equals(a.group()) && p.getName().equals(a.name())) .anyMatch(p -> PluginLoaderHelper.isCompatible( p.getVersion(), Version.valueOf(a.minVersion()) ) ) ); } PluginLoader(DataTypes dataTypes,
                      SourceTypes sourceTypes,
                      Components components,
                      Themes themes,
                      TabInfoRegistry tabInfoRegistry,
                      Converters converters,
                      PropertyParsers propertyParsers); static PluginLoader getDefault(); void loadAllJarsFromDir(Path directory); void loadPluginJar(URI jarUri); boolean loadPluginClass(Class<? extends Plugin> clazz); boolean load(Plugin plugin); boolean canLoad(Plugin plugin); @SuppressWarnings("unchecked") boolean unload(Plugin plugin); ObservableList<Plugin> getKnownPlugins(); ObservableSet<Plugin> getLoadedPlugins(); ObservableList<ClassLoader> getClassLoaders();  }
@Test public void testSelfDependentCannotBeLoaded() { Plugin plugin = new SelfDependentPlugin(); assertFalse(loader.canLoad(plugin), "A self-dependent plugin should never be able to be loaded"); }