mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
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.
26 lines
905 B
Java
26 lines
905 B
Java
package com.volmit;
|
|
|
|
import com.volmit.resource.ResourceId;
|
|
import java.util.Objects;
|
|
|
|
/** Module identity. Stages a module defines must use the namespace of its id. The name is for
|
|
* people, for example in load logs; the id is what the host and other modules match on.
|
|
*/
|
|
public record ModuleInfo(ResourceId id, String name, String version) {
|
|
public ModuleInfo {
|
|
Objects.requireNonNull(id, "id");
|
|
Objects.requireNonNull(name, "name");
|
|
Objects.requireNonNull(version, "version");
|
|
if (name.isBlank()) {
|
|
throw new IllegalArgumentException("Blank module name: " + id);
|
|
}
|
|
if (version.isBlank()) {
|
|
throw new IllegalArgumentException("Blank module version: " + id);
|
|
}
|
|
}
|
|
|
|
public static ModuleInfo of(String id, String name, String version) {
|
|
return new ModuleInfo(ResourceId.parse(id), name, version);
|
|
}
|
|
}
|