use of jadx.core.dex.attributes.nodes.RenameReasonAttr in project jadx by skylot.
the class RenameVisitor method checkClasses.
private static void checkClasses(Deobfuscator deobfuscator, RootNode root, JadxArgs args) {
List<ClassNode> classes = root.getClasses(true);
for (ClassNode cls : classes) {
checkClassName(deobfuscator, cls, args);
checkFields(deobfuscator, cls, args);
checkMethods(deobfuscator, cls, args);
}
if (!args.isFsCaseSensitive() && args.isRenameCaseSensitive()) {
Set<String> clsFullPaths = new HashSet<>(classes.size());
for (ClassNode cls : classes) {
ClassInfo clsInfo = cls.getClassInfo();
if (!clsFullPaths.add(clsInfo.getAliasFullPath().toLowerCase())) {
String newShortName = deobfuscator.getClsAlias(cls);
clsInfo.changeShortName(newShortName);
cls.addAttr(new RenameReasonAttr(cls).append("case insensitive filesystem"));
clsFullPaths.add(clsInfo.getAliasFullPath().toLowerCase());
}
}
}
processRootPackages(deobfuscator, root, classes);
}
use of jadx.core.dex.attributes.nodes.RenameReasonAttr in project jadx by skylot.
the class RenameVisitor method processRootPackages.
private static void processRootPackages(Deobfuscator deobfuscator, RootNode root, List<ClassNode> classes) {
Set<String> rootPkgs = collectRootPkgs(classes);
root.getCacheStorage().setRootPkgs(rootPkgs);
if (root.getArgs().isRenameValid()) {
// rename field if collide with any root package
for (ClassNode cls : classes) {
for (FieldNode field : cls.getFields()) {
if (rootPkgs.contains(field.getAlias())) {
deobfuscator.forceRenameField(field);
field.addAttr(new RenameReasonAttr("collision with root package name"));
}
}
}
}
}
Aggregations