New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DependencyResolver.resolve - removing dependents in check version block ? #250
Comments
The intention is not to remove the dependents plugins. The idea is to iterate over all dependents plugins and to check if the required version for each one is the expected one or not. Do you see a problem? If yes please add more details. If you can please add a (unit) test that replicate the problem. |
Thanks for the reply. When I changed the code to use an iterator instead - it seems to work correctly. for (PluginDescriptor plugin : plugins) {
String pluginId = plugin.getPluginId();
String existingVersion = plugin.getVersion();
List<String> dependents = getDependents(pluginId);
Iterator<String> it = dependents.iterator();
while(it.hasNext()){
String dependentId = it.next();
PluginDescriptor dependent = pluginByIds.get(dependentId);
String requiredVersion = getDependencyVersionSupport(dependent, pluginId);
boolean ok = checkDependencyVersion(requiredVersion, existingVersion);
if (!ok) {
result.addWrongDependencyVersion(new WrongDependencyVersion(pluginId, dependentId, existingVersion, requiredVersion));
it.remove();
}
}
} |
@surajpuvvada |
@surajpuvvada |
@decebals |
In
DependencyResolver.resolve()
- I noticed this block of code (https://github.com/pf4j/pf4j/blob/master/pf4j/src/main/java/org/pf4j/DependencyResolver.java#L93) where dependents.remove(0) is called. Doesn't this remove the dependent plugin ? Is this correct behavior ?For example: If I have A depend on B and I try to unload B it simply goes and unloads B without unloading A as
getDependents()
returns empty inAbstractDefaultManager.unloadPlugin()
call.The text was updated successfully, but these errors were encountered: