mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-31 12:41:25 +01:00
SPIGOT-5548: Show error that hints towards plugins misusing reflection
By: md_5 <git@md-5.net>
This commit is contained in:
parent
ffa5a5dba7
commit
109958b9e6
@ -1,5 +1,6 @@
|
||||
package org.bukkit.plugin.java;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -9,8 +10,8 @@ import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.CodeSource;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -39,7 +40,7 @@ final class PluginClassLoader extends URLClassLoader {
|
||||
final JavaPlugin plugin;
|
||||
private JavaPlugin pluginInit;
|
||||
private IllegalStateException pluginState;
|
||||
private final Set<String> seenIllegalAccess = new HashSet<>();
|
||||
private final Set<String> seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
@ -107,6 +108,7 @@ final class PluginClassLoader extends URLClassLoader {
|
||||
|
||||
if (result != null) {
|
||||
JavaPlugin provider = ((PluginClassLoader) result.getClassLoader()).plugin;
|
||||
Preconditions.checkState(provider != null, "Globally provided class %s has no plugin. Perhaps broken reflection is in use.", name);
|
||||
String providerName = provider.getName();
|
||||
|
||||
if (provider != plugin
|
||||
|
Loading…
Reference in New Issue
Block a user