Override classloader close method for completeness

This commit is contained in:
md_5 2021-04-09 15:38:21 +10:00
parent 6a039de8db
commit 425dd45109
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -54,16 +54,16 @@ final class PluginClassloader extends URLClassLoader
}
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
public Class<?> loadClass(String name) throws ClassNotFoundException
{
return loadClass0( name, resolve, true, true );
return loadClass0( name, true, true );
}
private Class<?> loadClass0(String name, boolean resolve, boolean checkOther, boolean checkLibraries) throws ClassNotFoundException
private Class<?> loadClass0(String name, boolean checkOther, boolean checkLibraries) throws ClassNotFoundException
{
try
{
return super.loadClass( name, resolve );
return super.loadClass( name );
} catch ( ClassNotFoundException ex )
{
}
@ -86,7 +86,7 @@ final class PluginClassloader extends URLClassLoader
{
try
{
return loader.loadClass0( name, resolve, false, proxy.getPluginManager().isTransitiveDepend( desc, loader.desc ) );
return loader.loadClass0( name, false, proxy.getPluginManager().isTransitiveDepend( desc, loader.desc ) );
} catch ( ClassNotFoundException ex )
{
}
@ -149,6 +149,18 @@ final class PluginClassloader extends URLClassLoader
throw new ClassNotFoundException( name );
}
@Override
public void close() throws IOException
{
try
{
super.close();
} finally
{
jar.close();
}
}
void init(Plugin plugin)
{
Preconditions.checkArgument( plugin != null, "plugin" );