mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
SPIGOT-6502: Loading a class from a library of another plugin resulted in a ClassCastException.
This commit is contained in:
parent
04df07fe9a
commit
7e29f76544
1 changed files with 3 additions and 1 deletions
|
@ -113,9 +113,11 @@ final class PluginClassLoader extends URLClassLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkGlobal) {
|
if (checkGlobal) {
|
||||||
|
// This ignores the libraries of other plugins, unless they are transitive dependencies.
|
||||||
Class<?> result = loader.getClassByName(name, resolve, description);
|
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;
|
PluginDescriptionFile provider = ((PluginClassLoader) result.getClassLoader()).description;
|
||||||
|
|
||||||
if (provider != description
|
if (provider != description
|
||||||
|
|
Loading…
Add table
Reference in a new issue