![](/img/trans.png)
[英]When using Hibernate for Java getting abnormal behavior binding parameterList in HQL
[英]Abnormal behavior while using proguard
我的原始代碼是:
private String hello;
private int i = 0;
public void test() {
if (i == 0) {
hello = "asdas";
} else {
hello = "asasvfasfas";
}
}
用proguard混淆之后:
private String a;
private int c = 0;
public void a()
{
if (this.c == 0);
for (this.a = "asdas"; ; this.a = "asasvfasfas")
return;
}
在項目屬性中:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
我的proguard-project.txt文件是空的,所以我猜它應該使用默認的配置文件:proguard-android.txt。
為什么會這樣? 如何防止這種代碼優化? 請幫忙。
因為您的代碼只是您輸入的片段,我認為,您的代碼將很容易優化到此:
private String hello;
public void test() {
hello = "asdas";
}
Proguard只是不刪除原始但無法訪問的源代碼行,只需將它們放入無法訪問的位置即可。 它將您的代碼轉換為等效但不那么人性化的格式。
因此,生成的代碼與您的代碼一樣,只是混淆了。 如果您不喜歡它,請不要使用混淆器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.