From 35f7b27135457e21a6511af2f00e300ccd3c1971 Mon Sep 17 00:00:00 2001 From: jglrxavpok Date: Sun, 25 Oct 2020 20:32:50 +0100 Subject: [PATCH] Comment to remember to fix extension dependency resolution in case we keep separate classloaders for extensions --- .../server/extensions/ExtensionDependencyResolver.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/minestom/server/extensions/ExtensionDependencyResolver.java b/src/main/java/net/minestom/server/extensions/ExtensionDependencyResolver.java index a3a0a2415..b228c2850 100644 --- a/src/main/java/net/minestom/server/extensions/ExtensionDependencyResolver.java +++ b/src/main/java/net/minestom/server/extensions/ExtensionDependencyResolver.java @@ -32,6 +32,11 @@ public class ExtensionDependencyResolver implements DependencyResolver { if(extensionMap.containsKey(extensionName)) { DiscoveredExtension ext = extensionMap.get(extensionName); // convert extension URLs to subdependencies + // FIXME: this is not a deep conversion, this might create an issue in this scenario with different classloaders: + // A depends on an external lib (Ext<-A) + // B depends on A (A<-B) + // When loading B, with no deep conversion, Ext will not be added to the list of dependencies (because it is not a direct dependency) + // But when trying to call/access code from extension A, the parts dependent on Ext won't be inside B's dependencies, triggering a ClassNotFoundException List deps = new LinkedList<>(); for(URL u : ext.files) { deps.add(new ResolvedDependency(u.toExternalForm(), u.toExternalForm(), "", u, new LinkedList<>()));