Describe your idea
I try to rename Variables based on the type of the Constructor.
For example this:
/* renamed from: T9.c0 */
/* loaded from: classes6.dex */
public final class C5365c0 {
/* renamed from: a */
public final connectionBroadcaster f14883a;
/* renamed from: b */
public final queueManager f14884b;
/* renamed from: c */
public boolean f14885c;
public C5365c0(connectionBroadcaster connectionbroadcaster, queueManager queuemanager) {
AbstractC6645l.notNull(connectionbroadcaster, "connectionBroadcaster");
AbstractC6645l.notNull(queuemanager, "queueManager");
this.f14883a = connectionbroadcaster;
this.f14884b = queuemanager;
}
should become
public final class C5365c0 {
/* renamed from: a */
/* renamed from: f14883a */
public final connectionBroadcaster connectionbroadcaster;
/* renamed from: b */
/* renamed from: f14884b */
public final queueManager queuemanager;
/* renamed from: c */
public boolean f14885c;
public C5365c0(connectionBroadcaster connectionbroadcaster, queueManager queuemanager) {
AbstractC6645l.notNull(connectionbroadcaster, "connectionBroadcaster");
AbstractC6645l.notNull(queuemanager, "queueManager");
this.connectionbroadcaster = connectionbroadcaster;
this.queuemanager = queuemanager;
}
What I tried so far is:
val jadx = getJadxInstance()
val targetClass = jadx.classes.find { it.fullName.contains("C5365c0") }
log.warn { "$targetClass" }
if (targetClass != null) {
for (method in targetClass.methods) {
if (method.name == "<init>") { // Find the constructor
log.warn("Processing constructor: ${method.fullName}")
log.warn(method.arguments.toString())
val fields = targetClass.fields
for (field in targetClass.fields) {
if (field.name.length <= 8 && field.name.startsWith("f")) {
println("${field.type.toString().substringAfterLast('.')} ${field.name} matches conditions")
//val fld = targetClass.searchField(field.name)
//println("$fld test")
} else {
println("${field.type} ${field.name} doesnt matches conditions")
}
}
log.warn(fields.toString())
}
}
}
Output:
WARN : p368T9.C5365c0
WARN : Processing constructor: T9.c0.<init>
WARN : [p368T9.connectionBroadcaster, p368T9.queueManager]
INFO : connectionBroadcaster f14883a matches conditions
INFO : queueManager f14884b matches conditions
INFO : boolean f14885c matches conditions
WARN : [T9.c0.a :T9.p, T9.c0.b :T9.V, T9.c0.c :boolean]
But here i'm stuck with unable to rename the field variable, as there seems no rename function.
I tried another approach with this code:
import jadx.core.dex.nodes.MethodNode
import jadx.plugins.script.runtime.data.ScriptOrderedDecompilePass
val jadx = getJadxInstance()
// StringBuilder chain replaced by STR_CONCAT instruction in SimplifyVisitor
// Search for return with STR_CONCAT and process args
jadx.addPass(object : ScriptOrderedDecompilePass(
jadx,
"DeobfFromToString",
runAfter = listOf("SimplifyVisitor"),
) {
override fun visit(mth: MethodNode) {
val targetClassFound = mth.parentClass.fullName.contains("C5365c0")
if (targetClassFound && mth.name == "<init>") {
val targetClass = mth.parentClass
log.warn { "$targetClass" }
log.warn("Processing constructor: $mth")
val fields = targetClass.fields // Get all fields in the class
for (field in targetClass.fields) {
if (field.name.length <= 8 && field.name.startsWith("f")) {
println("${field.type.toString().substringAfterLast('.')} ${field.name} matches conditions")
} else {
println("${field.type} ${field.name} doesnt matches conditions")
}
}
log.warn(fields.toString())
}
}
})
But at this Point the Constructor Types seems not to be replaced yet:
WARN : T9.c0
WARN : Processing constructor: T9.c0.<init>(T9.p, T9.V):void
INFO : T9.p a doesnt matches conditions
INFO : T9.V b doesnt matches conditions
INFO : boolean c doesnt matches conditions
WARN : [T9.c0.a :T9.p, T9.c0.b :T9.V, T9.c0.c :boolean]
WARN : T9.c0
WARN : Processing constructor: T9.c0.<init>(T9.p, T9.V):void
INFO : T9.p a doesnt matches conditions
INFO : T9.V b doesnt matches conditions
INFO : boolean c doesnt matches conditions
WARN : [T9.c0.a :T9.p, T9.c0.b :T9.V, T9.c0.c :boolean]
Describe your idea
I try to rename Variables based on the type of the Constructor.
For example this:
should become
What I tried so far is:
Output:
But here i'm stuck with unable to rename the field variable, as there seems no rename function.
I tried another approach with this code:
But at this Point the Constructor Types seems not to be replaced yet: