gpt4 book ai didi

obfuscation - 如何避免混淆器混淆用@OnStart 注释的类

转载 作者:行者123 更新时间:2023-12-04 19:37:41 25 4
gpt4 key购买 nike

在基于 NetBeans Platform 7.2 的应用程序中,可以用这段代码替换 ModuleInstall 类:

import org.openide.modules.OnStart;
import org.openide.modules.OnStop;

@OnStart
public final class Installer implements Runnable {

@Override
public void run() {
System.out.println("enable something...");
}

@OnStop
public static final class Down implements Runnable {
@Override
public void run() {
System.out.println("disable something...");
}
}
}

我的问题是,经过混淆后,类加载器没有找到带注释的类。

在我添加的 Proguard 配置中(按照建议 here )

-keep @org.openide.modules.OnStart class *

但显然这还不够或不起作用。

有人有什么建议吗?

最佳答案

据我所知,您需要明确保留用于保留任何规范的注释。所以,在你的情况下,添加

-keep enum org.openide.modules.OnStart

将允许此注释用作选择器。如果注释选择器实际上不匹配,Proguard 确实应该包含一条警告消息。保留注释也没有任何意义,特别是如果它不是运行时保留的话。

关于obfuscation - 如何避免混淆器混淆用@OnStart 注释的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12973658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com