From 104bd3e44e9d3846d05d78aebb2309682dc9fa1d Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:05:07 +0800 Subject: [PATCH] chore: mark deprecated constructor for base plugin (#6277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /milestone 2.18.x #### What this PR does / why we need it: 将 BasePlugin 的 PluginWrapper 构造函数标记为过时并输出警告日志提示 #### Does this PR introduce a user-facing change? ```release-note 在 BasePlugin 的 PluginWrapper 构造函数输出过时警告日志以提醒开发者尽快适配 ``` --- api/src/main/java/run/halo/app/plugin/BasePlugin.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/src/main/java/run/halo/app/plugin/BasePlugin.java b/api/src/main/java/run/halo/app/plugin/BasePlugin.java index bde5bc9f9..88cdc2ccf 100644 --- a/api/src/main/java/run/halo/app/plugin/BasePlugin.java +++ b/api/src/main/java/run/halo/app/plugin/BasePlugin.java @@ -3,6 +3,7 @@ package run.halo.app.plugin; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.pf4j.Plugin; +import org.pf4j.PluginWrapper; /** * This class will be extended by all plugins and serve as the common class between a plugin and @@ -26,6 +27,15 @@ public class BasePlugin extends Plugin { this.context = pluginContext; } + @Deprecated(since = "2.7.0", forRemoval = true) + public BasePlugin(PluginWrapper wrapper) { + super(wrapper); + log.warn("Deprecated constructor 'BasePlugin(PluginWrapper wrapper)' called, please use " + + "'BasePlugin(PluginContext pluginContext)' instead for plugin '{}',This " + + "constructor will be removed in 2.19.0", + wrapper.getPluginId()); + } + public BasePlugin() { } }