mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Read module info once at discovery and keep it in DiscoveredModule
DiscoveredModule is now a final class holding the module, the ModuleInfo read when the module was found (pack jar or builtIn) and its origin. Graph install, load errors, the pack summary and optional-package filtering use only that stored value.
This commit is contained in:
1 parent
f5cf4b3ab6
commit
6263075ecd
9 files changed
+163
-22
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package com.volmit.host;
|
||||
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -83,8 +84,7 @@ record ModuleJar(Path path, String origin, String entryClass, List<JarClass> cla
|
||||
var type = loadEntryClass(packLoader);
|
||||
requireDefinedHere(type);
|
||||
var module = instantiate(type);
|
||||
requireIdentity(module);
|
||||
return new DiscoveredModule(module, origin);
|
||||
return DiscoveredModule.fromJar(module, readIdentity(module), origin);
|
||||
}
|
||||
|
||||
/** Opens the jar with the runtime's multi-release version, like the pack class loader does, so
|
||||
@@ -197,9 +197,9 @@ record ModuleJar(Path path, String origin, String entryClass, List<JarClass> cla
|
||||
}
|
||||
}
|
||||
|
||||
private void requireIdentity(IrisModule module) {
|
||||
private ModuleInfo readIdentity(IrisModule module) {
|
||||
try {
|
||||
Objects.requireNonNull(module.info(), "info() returned null");
|
||||
return Objects.requireNonNull(module.info(), "info() returned null");
|
||||
} catch (RuntimeException | LinkageError exception) {
|
||||
throw brokenEntryPoint("info() failed: " + exception, exception);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user