diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java index 5abee4234697..c72db6dcb655 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java @@ -164,6 +164,9 @@ public EnsoContext( scala.Option.empty()); this.home = home; this.builtins = new Builtins(this); + // Insert default host class loader. + var builtinsLibName = new LibraryName(Builtins.NAMESPACE, Builtins.PACKAGE_NAME); + this.hostClassLoaders.put(builtinsLibName, new HostClassLoader(null)); this.notificationHandler = notificationHandler; this.lockManager = lockManager; this.distributionManager = distributionManager; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java index 69c61274454d..0ac2923b8e1e 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java @@ -3,7 +3,6 @@ import com.oracle.truffle.api.TruffleFile; import java.net.URL; import java.net.URLClassLoader; -import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.enso.pkg.Package; @@ -37,7 +36,7 @@ final class HostClassLoader extends URLClassLoader implements AutoCloseable { public HostClassLoader(Package pkg) { super(new URL[0]); this.pkg = pkg; - assert pkg.polyglotDir().exists(); + assert pkg == null || pkg.polyglotDir().exists(); } static { @@ -95,6 +94,10 @@ public void close() { @Override public String toString() { - return "HostClassLoader(" + pkg.libraryName() + ")"; + if (pkg != null) { + return "HostClassLoader(" + pkg.libraryName() + ")"; + } else { + return "HostClassLoader"; + } } }