ProGuard - 使用唯一的字段名称?

发布于 2025-01-13 22:08:01 字数 397 浏览 3 评论 0原文

我正在使用 ProGuard 来混淆我的源代码,但我遇到了一个问题,即我的混淆代码对不同类型的字段重复使用相同的字段名称。例如:

public class Pojo {
    int id;
    String name;
}

变成:

public class Pojo {
    int a;
    String a;
}

这在尝试使用 JSON 序列化/反序列化时会导致问题,因此我希望使用唯一的字段名称。

我尝试添加 -useuniqueclassmembernames 但它不起作用。除了可能使用 -obfuscationdictionary 选项之外,看不到任何其他选项,但这似乎有点矫枉过正。

I'm using ProGuard to obfuscate my source code, but I'm running into a problem where my obfuscated code re-uses the same field name for fields with different types. For example:

public class Pojo {
    int id;
    String name;
}

Becomes:

public class Pojo {
    int a;
    String a;
}

This is causing problems when trying to use JSON serialization/deserialization, so I'd like to have unique field names instead.

I tried adding -useuniqueclassmembernames though it didn't work. Couldn't see any other options, besides maybe using the -obfuscationdictionary option, but that seems like overkill.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文