diff --git a/src/main/java/cpw/mods/jarhandling/impl/Jar.java b/src/main/java/cpw/mods/jarhandling/impl/Jar.java index 06c8019..469dbb3 100644 --- a/src/main/java/cpw/mods/jarhandling/impl/Jar.java +++ b/src/main/java/cpw/mods/jarhandling/impl/Jar.java @@ -357,7 +357,7 @@ private Set gatherPackages() { var ret = new HashSet(); for (var file : files) { int idx = file.lastIndexOf('/'); - if (!file.endsWith(".class") || idx == -1) + if (idx == -1 || !file.endsWith(".class")) continue; ret.add(file.substring(0, idx).replace('/', '.')); } diff --git a/src/main/java/net/minecraftforge/securemodules/SecureModuleFinder.java b/src/main/java/net/minecraftforge/securemodules/SecureModuleFinder.java index 9ecc0e2..804910e 100644 --- a/src/main/java/net/minecraftforge/securemodules/SecureModuleFinder.java +++ b/src/main/java/net/minecraftforge/securemodules/SecureModuleFinder.java @@ -24,7 +24,7 @@ public class SecureModuleFinder implements ModuleFinder { private final Map references = new HashMap<>(); - protected SecureModuleFinder(final SecureJar... jars) { + protected SecureModuleFinder(final Iterable jars) { for (var jar : jars) { var data = jar.moduleDataProvider(); if (references.containsKey(data.name())) @@ -34,6 +34,10 @@ protected SecureModuleFinder(final SecureJar... jars) { } } + protected SecureModuleFinder(final SecureJar... jars) { + this(Arrays.asList(jars)); + } + @Override public Optional find(final String name) { return Optional.ofNullable(references.get(name)); @@ -48,6 +52,10 @@ public static SecureModuleFinder of(SecureJar... jars) { return new SecureModuleFinder(jars); } + public static SecureModuleFinder of(Iterable jars) { + return new SecureModuleFinder(jars); + } + private static class Reference extends SecureModuleReference { private final SecureJar.ModuleDataProvider jar; private final Manifest manifest;