混淆包含注释的类
混淆 .class 文件时,注释将被删除。有没有办法混淆这些文件(包含注释的文件)而不删除它们。如果可能的话,有没有办法混淆未编译的 .java 文件以保留注释?
java编译器如何处理注释以及它们保存在哪里?为什么混淆后所有注释都被删除。在混淆类之后,我不能带回注释并将它们放回到原来的位置以便工作吗?
When obfuscating .class files annotations are removed. Is there a way to obfuscate these files(files containing annotations) without removing them. Is there a way to obfuscate non compiled .java files to preserve annotations, if it's possible?
How does java compiler treat annotations and where are they preserved? why after obfuscation all the annotations are removed. Can't I, after obfuscating the classes, bring back the annotations and put them back in their place in order to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我询问并研究了注释和混淆,我发现了以下内容:
并且很难操纵它们。混淆程序不处理此类
,但是它们都不能混淆带有注释的类
它们的所有字段和方法都已注释
文件而不是注释
I asked and researched on annotations and obfuscation and I've found the following:
and it's very hard to manipulate them. Obfuscation programs don't deal with such classes
ones, but neither of them could obfuscate annotated classes that have
all of their fields and methods annotated
files instead of annotations
我们通常使用 proguard 混淆已经编译的类,我可以肯定,不可能混淆未编译的 . java 文件,因为它正在处理字节码本身。
要保留注释,您可以告诉 proguard 保留注释等特定属性。您可以在示例章节中找到更多信息。我建议使用 proguardGui 为混淆过程构建您自己的配置文件。
We generally obfuscated already compiled classes with proguard and I am kind of sure, it's not possible to obfuscate non compiled .java files, since it's working on the byte-code itself.
To keep your annotations, you can tell proguard to keep specific attributes like annotations. You can find more information in their example chapter. I recommend using proguardGui to build your own configuration file for the obfuscation-process.