Skip to content

Commit

Permalink
Insert default HostClassLoader for builtin lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Akirathan committed Dec 17, 2024
1 parent c98bdaf commit 84be175
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,7 +36,7 @@ final class HostClassLoader extends URLClassLoader implements AutoCloseable {
public HostClassLoader(Package<TruffleFile> pkg) {
super(new URL[0]);
this.pkg = pkg;
assert pkg.polyglotDir().exists();
assert pkg == null || pkg.polyglotDir().exists();
}

static {
Expand Down Expand Up @@ -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";
}
}
}

0 comments on commit 84be175

Please sign in to comment.