Let pack jars use classes nobody has, as optional dependencies

The class check was stricter than the JVM: a bundled library that
references optional integrations failed the whole pack, although that
code only runs when the classes exist. Each missing reference is now
classified:

- the host has the class but hides it (Iris internals, Iris's copy of
  a library): load error, saying modules cannot use Iris's classes;
- missing from the API: load error, as before (different Iris build);
- nobody has it: the pack loads. PackModules.missingClasses() lists
  the classes per jar and the load logs one capped WARNING per pack,
  formatted by MissingClassesWarning.

Reference resolution moves from PackClassCheck to PackReferenceCheck.
This commit is contained in:
piexel committed 2026-10-05 20:27:24 +02:00
1 parent b7b3993a8d
commit 98bd9a9c12
9 files changed
+326 -91

No files matched your search

@@ -0,0 +1,18 @@
package com.volmit.host;
import java.util.List;
import java.util.Objects;
/** Classes a module jar uses that neither its pack, Iris nor the JDK has, usually optional
* dependencies of a library the jar bundles. The jar still loads; code that needs one of these
* classes throws {@link NoClassDefFoundError} when it runs.
*
* @param origin the jar path relative to its pack
* @param classNames the missing classes as sorted binary names
*/
public record MissingClasses(String origin, List<String> classNames) {
public MissingClasses {
Objects.requireNonNull(origin, "origin");
classNames = List.copyOf(classNames);
}
}