[FEATURE] ModuleLaunch bug fix

This commit is contained in:
Gravita 2023-11-01 00:10:19 +07:00
parent b638efc0d1
commit 6cd5a69149

View file

@ -2,6 +2,7 @@
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.LogHelper;
import java.io.IOException;
import java.io.InputStream;
@ -133,8 +134,16 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
}
@Override
protected Class<?> findClass(String moduleName, String name) {
protected Class<?> findClass(String name) throws ClassNotFoundException {
var clazz = findClass(null, name);
if(clazz == null) {
throw new ClassNotFoundException(name);
}
return clazz;
}
@Override
protected Class<?> findClass(String moduleName, String name) {
Class<?> clazz;
{
clazz = classMap.get(name);
@ -164,7 +173,11 @@ protected Class<?> findClass(String moduleName, String name) {
}
}
if(clazz == null) {
clazz = super.findClass(moduleName, name);
try {
clazz = super.findClass(name);
} catch (ClassNotFoundException e) {
return null;
}
}
if(clazz != null) {
classMap.put(name, clazz);