diff --git a/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginClassLoaderImpl.java b/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginClassLoaderImpl.java index 097f93cdc..c20d448d2 100644 --- a/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginClassLoaderImpl.java +++ b/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginClassLoaderImpl.java @@ -18,7 +18,8 @@ final class PluginClassLoaderImpl extends ClassLoader implements PluginClassLoad private final PluginSource source; private final String id; - PluginClassLoaderImpl(@Nonnull PluginGraph graph, @Nonnull PluginSource source, @Nonnull String id) { + PluginClassLoaderImpl(@Nonnull ClassLoader classLoader, @Nonnull PluginGraph graph, @Nonnull PluginSource source, @Nonnull String id) { + super(classLoader); this.graph = graph; this.source = source; this.id = id; diff --git a/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginGraph.java b/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginGraph.java index 58ec7fa84..ca743cf76 100644 --- a/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginGraph.java +++ b/recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginGraph.java @@ -46,7 +46,9 @@ Collection> apply(@Nonnull List preparedPlugi if (plugins.containsKey(id)) { throw new PluginException("Plugin %s is already loaded".formatted(id)); } - var classLoader = new PluginClassLoaderImpl(this, preparedPlugin.pluginSource(), id); + var threadContextClassLoader = Thread.currentThread().getContextClassLoader(); + var parentLoader = threadContextClassLoader != null ? threadContextClassLoader : ClassLoader.getSystemClassLoader(); + var classLoader = new PluginClassLoaderImpl(parentLoader, this, preparedPlugin.pluginSource(), id); LoadedPlugin loadedPlugin = new LoadedPlugin(new PluginContainerImpl<>(preparedPlugin, classLoader)); if (temp.putIfAbsent(id, loadedPlugin) != null) {