Commit Graph
3 Commits
Author SHA1 Message Date
piexel 1553959cf4 Limit pack modules to the API, the JDK and their own pack
The pack class loader's parent is now ApiAndJdkClassLoader: com.volmit.
classes and resources come from the API's loader, everything else from
the platform loader, so modules no longer see Iris internals or the
libraries Iris bundles.

Before any class is defined, a pack load now fails when a jar holds a
com.volmit. class, and when a class references a class that is not in
the API, the JDK or a jar of the pack (read with java.lang.classfile).
Linkage errors while installing name the module's jar. ModuleInfo names
and versions reject line breaks and other control characters.
2026-10-05 18:24:53 +02:00
piexel b137bc6d92 Add module display names, reject duplicate pack classes, log pack modules
ModuleInfo gains a required, non-blank display name next to id and
version: ModuleInfo.of(id, name, version).

PackModules now fails when a class is in two jars of one pack, naming
the class and both jars. ModuleJar indexes class names while it reads
the entry point, so the check runs before the pack class loader exists
and nothing is half-loaded. Jars are read with the runtime's
multi-release version, like the loader reads them: a versioned class
counts once under its base name; module-info.class and anything under
META-INF/ are ignored.

A successful load logs one INFO summary through System.Logger with the
display name, id, version and jar of each module, or a line saying the
pack has no module jars. PackModulesSummary builds the text and is
tested without a logging backend.
2026-10-05 18:02:31 +02:00
piexel 6388173f19 Load pack modules from <pack>/modules jars
A module jar names its IrisModule class in
META-INF/services/com.volmit.IrisModule. PackModules scans
<pack>/modules/*.jar in file name order, loads all jars of a pack
through one URLClassLoader whose parent is the API's loader, and
closes it when the pack unloads.

Modules now reach LoadedModules as DiscoveredModule (module plus
origin), so errors name the offending jar: missing or multiple entry
points, broken entry classes, duplicate module ids and foreign stage
namespaces.
2026-10-05 17:48:58 +02:00