use of jadx.core.dex.info.ClassInfo in project jadx by skylot.
the class ClassNode method addSourceFilenameAttr.
private void addSourceFilenameAttr(String fileName) {
if (fileName == null) {
return;
}
if (fileName.endsWith(".java")) {
fileName = fileName.substring(0, fileName.length() - 5);
}
if (fileName.isEmpty() || fileName.equals("SourceFile") || fileName.equals("\"")) {
return;
}
if (clsInfo != null) {
String name = clsInfo.getShortName();
if (fileName.equals(name)) {
return;
}
if (fileName.contains("$") && fileName.endsWith("$" + name)) {
return;
}
ClassInfo parentClass = clsInfo.getTopParentClass();
if (parentClass != null && fileName.equals(parentClass.getShortName())) {
return;
}
}
this.addAttr(new SourceFileAttr(fileName));
LOG.debug("Class '{}' compiled from '{}'", this, fileName);
}
use of jadx.core.dex.info.ClassInfo in project jadx by skylot.
the class DexNode method initInnerClasses.
void initInnerClasses() {
// move inner classes
List<ClassNode> inner = new ArrayList<ClassNode>();
for (ClassNode cls : classes) {
if (cls.getClassInfo().isInner()) {
inner.add(cls);
}
}
for (ClassNode cls : inner) {
ClassInfo clsInfo = cls.getClassInfo();
ClassNode parent = resolveClass(clsInfo.getParentClass());
if (parent == null) {
clsMap.remove(clsInfo);
clsInfo.notInner(cls.dex());
clsMap.put(clsInfo, cls);
} else {
parent.addInnerClass(cls);
}
}
}
use of jadx.core.dex.info.ClassInfo in project jadx by skylot.
the class Deobfuscator method doClass.
private void doClass(ClassNode cls) {
ClassInfo classInfo = cls.getClassInfo();
String pkgFullName = classInfo.getPackage();
PackageNode pkg = getPackageNode(pkgFullName, true);
doPkg(pkg, pkgFullName);
String alias = deobfPresets.getForCls(classInfo);
if (alias != null) {
clsMap.put(classInfo, new DeobfClsInfo(this, cls, pkg, alias));
return;
}
if (clsMap.containsKey(classInfo)) {
return;
}
if (shouldRename(classInfo.getShortName())) {
makeClsAlias(cls);
}
}
use of jadx.core.dex.info.ClassInfo in project jadx by skylot.
the class Deobfuscator method getNameWithoutPackage.
String getNameWithoutPackage(ClassInfo clsInfo) {
String prefix;
ClassInfo parentClsInfo = clsInfo.getParentClass();
if (parentClsInfo != null) {
DeobfClsInfo parentDeobfClsInfo = clsMap.get(parentClsInfo);
if (parentDeobfClsInfo != null) {
prefix = parentDeobfClsInfo.makeNameWithoutPkg();
} else {
prefix = getNameWithoutPackage(parentClsInfo);
}
prefix += INNER_CLASS_SEPARATOR;
} else {
prefix = "";
}
return prefix + clsInfo.getShortName();
}
use of jadx.core.dex.info.ClassInfo in project jadx by skylot.
the class Deobfuscator method makeClsAlias.
private String makeClsAlias(ClassNode cls) {
ClassInfo classInfo = cls.getClassInfo();
String alias = null;
if (this.useSourceNameAsAlias) {
alias = getAliasFromSourceFile(cls);
}
if (alias == null) {
String clsName = classInfo.getShortName();
alias = String.format("C%04d%s", clsIndex++, makeName(clsName));
}
PackageNode pkg = getPackageNode(classInfo.getPackage(), true);
clsMap.put(classInfo, new DeobfClsInfo(this, cls, pkg, alias));
return alias;
}
Aggregations