Skip to content

Commit

Permalink
Allow plugin classloader to define a parent classloader
Browse files Browse the repository at this point in the history
Required to support a change in the launcher that will allow us to bypass outdated bundled FX artifacts in JDK distros
  • Loading branch information
Col-E committed Nov 24, 2024
1 parent 4e8f402 commit 5c4fa52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ Collection<PluginContainer<?>> apply(@Nonnull List<PreparedPlugin> 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) {
Expand Down

0 comments on commit 5c4fa52

Please sign in to comment.