From 425dd4510989834c52d21d38e239ba0c7a4b02d2 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 9 Apr 2021 15:38:21 +1000 Subject: [PATCH] Override classloader close method for completeness --- .../bungee/api/plugin/PluginClassloader.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/PluginClassloader.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginClassloader.java index cda92c9c..8fe5eb17 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginClassloader.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginClassloader.java @@ -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" );