问题描述
我的Minecraft Bukkit插件中有此类:
Have have this class in my Minecraft Bukkit plugin:
public class AsyncPlayerChatListener implements Listener
{
@EventHandler(priority = EventPriority.HIGH)
public void onEvent(AsyncPlayerChatEvent event)
{
}
}
我想保留该方法及其注释.这是我当前的proguard配置:
And I want to keep the method along with its annotation. This is my current proguard configuration:
-keep class * extends org.bukkit.event.Listener {
@org.bukkit.event.EventHandler <methods>;
}
ProGuard当前保留该方法并删除注释.我该如何指定将所有EventHandler注释保留在实现Listener的类中(或在任何地方的所有EventHandler注释也可以)?
ProGuard currently keeps the method and removes the annotation. How can I specify to keep all EventHandler annotations in classes implementing Listener (or all EventHandler annotation anywhere, would be fine too)?
我知道
-keepattributes *Annotation*
存在,但是我想这会使ProGuard在任何地方保留任何注释.
exists, but I guess this would make ProGuard keep any annotation anywhere.
推荐答案
很遗憾,我无法对此进行测试,但这可能会有所帮助(?):
I was unforunately unable to test this, but this may help(?):
-keepclassmembers class * extends org.bukkit.event.Listener {
@org.bukkit.event.EventHandler public *;
}
这篇关于Proguard:保留特定方法的注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!