Stop reserving namespaces, let a jar list several modules and add ModuleJarCheck for builds that write module jars

ReservedNamespaces and ModuleHost.reservingNamespaces are gone: a pack module may use any
namespace, iris included. A module id is still loaded once, and the duplicate error now names
the origin and class of both modules, so two modules of one jar can be told apart.

A jar lists one module class per line in META-INF/services/com.volmit.IrisModule and loads all
of them in that order; each class must still be defined in the jar. A jar with several modules
is excused by the optional packages of all of them.

ModuleJarCheck runs the load's class checks on one jar without loading it.
This commit is contained in:
piexel committed 2026-10-09 14:08:33 +02:00
1 parent ef4b640867
commit 42d31a9ce4
21 files changed
+330 -208

No files matched your search

@@ -26,8 +26,6 @@ public record LoadedModules(
/** Pass the built-in modules together with {@link PackModules#modules()} of the pack.
*
* @param reservedHostFields JSON fields the host itself uses, per attachment target
* @param reservedNamespaces namespaces only built-in modules may use, such as {@code iris}; a
* pack module whose id uses one fails the load
* @param hostTypePackages packages whose classes the host describes itself, each with its
* subpackages; only built-in modules' settings may use them (see {@link ModuleHost#describingHostTypesIn})
* @param reservedFolders pack folders the host reads itself, which no resource kind may read (see
@@ -36,11 +34,8 @@ public record LoadedModules(
public static LoadedModules load(
List<DiscoveredModule> modules,
Map<FeatureAttachment.Target, Set<String>> reservedHostFields,
Collection<String> reservedNamespaces,
Collection<String> hostTypePackages,
Collection<String> reservedFolders) {
var reserved = ReservedNamespaces.of(reservedNamespaces);
modules.forEach(reserved::requireAllowed);
var registry = new ModuleRegistry(reservedHostFields, Set.copyOf(reservedFolders));
var stages = new StageGraphBuilder();
for (var discovered : modules) {