Skip to content

Commit

Permalink
fix: don't rename R class in deobfuscation (#572) (PR #573)
Browse files Browse the repository at this point in the history
  • Loading branch information
asashour authored and skylot committed Apr 9, 2019
1 parent 23c05bb commit ab4721a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ private void collectClassHierarchy(ClassNode cls, Set<ClassNode> collected) {
}

private void processClass(ClassNode cls) {
if (isR(cls.getParentClass())) {
return;
}
ClassInfo clsInfo = cls.getClassInfo();
String fullName = getClassFullName(clsInfo);
if (!fullName.equals(clsInfo.getFullName())) {
Expand Down Expand Up @@ -559,4 +562,27 @@ public Map<MethodInfo, String> getMthMap() {
public PackageNode getRootPackage() {
return rootPackage;
}

private static boolean isR(ClassNode cls) {
if (!cls.getClassInfo().getShortName().equals("R")) {
return false;
}
if (!cls.getMethods().isEmpty() || !cls.getFields().isEmpty()) {
return false;
}
for (ClassNode inner : cls.getInnerClasses()) {
for (MethodNode m : inner.getMethods()) {
if (!m.getMethodInfo().isConstructor() && !m.getMethodInfo().isClassInit()) {
return false;
}
}
for (FieldNode field : cls.getFields()) {
ArgType type = field.getType();
if (type != ArgType.INT && (!type.isArray() || type.getArrayElement() != ArgType.INT)) {
return false;
}
}
}
return true;
}
}

0 comments on commit ab4721a

Please sign in to comment.