Hopefully properly load class depenending on classes from other plugins.

This commit is contained in:
md_5 2013-02-01 21:40:32 +11:00
parent 00e0e3c1a3
commit be4a764932

View File

@ -17,7 +17,20 @@ public class PluginClassloader extends URLClassLoader
} }
@Override @Override
protected Class<?> findClass(String name) throws ClassNotFoundException protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
{
return loadClass0(name, resolve, true);
}
private Class<?> loadClass0(String name, boolean resolve, boolean checkOther) throws ClassNotFoundException
{
try
{
return super.loadClass(name, resolve);
} catch (ClassNotFoundException ex)
{
}
if (checkOther)
{ {
for (PluginClassloader loader : allLoaders) for (PluginClassloader loader : allLoaders)
{ {
@ -25,12 +38,13 @@ public class PluginClassloader extends URLClassLoader
{ {
try try
{ {
return loader.loadClass(name); return loader.loadClass0(name, resolve, false);
} catch (ClassNotFoundException ex) } catch (ClassNotFoundException ex)
{ {
} }
} }
} }
}
throw new ClassNotFoundException(); throw new ClassNotFoundException();
} }
} }