SPIGOT-6502: Loading a class from a library of another plugin resulted in a ClassCastException.

This commit is contained in:
blablubbabc 2021-06-11 14:00:18 +10:00 committed by md_5
parent 04df07fe9a
commit 7e29f76544
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11

View file

@ -113,9 +113,11 @@ final class PluginClassLoader extends URLClassLoader {
}
if (checkGlobal) {
// This ignores the libraries of other plugins, unless they are transitive dependencies.
Class<?> result = loader.getClassByName(name, resolve, description);
if (result != null) {
// If the class was loaded from a library instead of a PluginClassLoader, we can assume that its associated plugin is a transitive dependency and can therefore skip this check.
if (result != null && result.getClassLoader() instanceof PluginClassLoader) {
PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description;
if (provider != description