[Change] Core 为 FrameworkManager 内的 DevelopmentPluginLoader 补充对类加载策略的设置;

[Change] FrameworkManager 为 DevelopmentPluginLoader 重写 'createPluginClassLoader' 方法, 以提供 ClassLoadingStrategy 策略;
This commit is contained in:
LamGC 2020-11-22 20:19:27 +08:00
parent cd5c813b70
commit 039a686f90
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -22,6 +22,7 @@ import net.lamgc.cgj.bot.event.EventExecutor;
import org.pf4j.*;
import java.io.File;
import java.nio.file.Path;
/**
* 框架管理器.
@ -43,7 +44,13 @@ public class FrameworkManager extends JarPluginManager {
@Override
protected PluginLoader createPluginLoader() {
return new CompoundPluginLoader()
.add(new DevelopmentPluginLoader(this), this::isDevelopment)
.add(new DevelopmentPluginLoader(this) {
@Override
protected PluginClassLoader createPluginClassLoader(Path pluginPath, PluginDescriptor pluginDescriptor) {
return new PluginClassLoader(FrameworkManager.this, pluginDescriptor,
getClass().getClassLoader(), ClassLoadingStrategy.ADP);
}
}, this::isDevelopment)
.add(new JarFrameworkLoader(this), this::isNotDevelopment);
}