SPIGOT-6749: Library Loader does not correctly isolate dependencies

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2021-10-13 08:12:16 +11:00
parent 6882afca7b
commit 5814757cc7

View file

@ -101,7 +101,12 @@ final class PluginClassLoader extends URLClassLoader {
Class<?> loadClass0(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException {
try {
return super.loadClass(name, resolve);
Class<?> result = super.loadClass(name, resolve);
// SPIGOT-6749: Library classes will appear in the above, but we don't want to return them to other plugins
if (checkGlobal || result.getClassLoader() == this) {
return result;
}
} catch (ClassNotFoundException ex) {
}