Commit 5f0dbf85 authored by tRuNKator's avatar tRuNKator Committed by skylot

fix: don't rename R class fields alias (PR #492)

* fix: R class fields alias
* implemented with clearer approach
parent 2e9039da
......@@ -11,6 +11,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import jadx.core.dex.attributes.AFlag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
......@@ -225,6 +226,8 @@ public class Deobfuscator {
clsInfo.rename(cls.dex().root(), fullName);
}
for (FieldNode field : cls.getFields()) {
if (field.contains(AFlag.DONT_RENAME))
continue;
renameField(field);
}
for (MethodNode mth : cls.getMethods()) {
......
......@@ -19,6 +19,7 @@ public enum AFlag {
DONT_SHRINK,
DONT_INLINE,
DONT_GENERATE,
DONT_RENAME, // do not rename during deobfuscation
SKIP,
REMOVE,
......
......@@ -6,6 +6,7 @@ import java.util.Map;
import java.util.TreeMap;
import com.android.dx.rop.code.AccessFlags;
import jadx.core.dex.attributes.AFlag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
......@@ -124,6 +125,7 @@ public class AndroidResourcesUtils {
if (fieldNode != null
&& !fieldNode.getName().equals(resName)
&& NameMapper.isValidIdentifier(resName)) {
fieldNode.add(AFlag.DONT_RENAME);
fieldNode.getFieldInfo().setAlias(resName);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment