Commit 03ae3bce authored by Skylot's avatar Skylot

fix: process field init code in dependency collector (#467)

parent 52deb48a
...@@ -18,6 +18,7 @@ import jadx.core.dex.nodes.DexNode; ...@@ -18,6 +18,7 @@ import jadx.core.dex.nodes.DexNode;
import jadx.core.dex.nodes.FieldNode; import jadx.core.dex.nodes.FieldNode;
import jadx.core.dex.nodes.InsnNode; import jadx.core.dex.nodes.InsnNode;
import jadx.core.dex.nodes.MethodNode; import jadx.core.dex.nodes.MethodNode;
import jadx.core.dex.nodes.parser.FieldInitAttr;
import jadx.core.utils.exceptions.JadxException; import jadx.core.utils.exceptions.JadxException;
public class DependencyCollector extends AbstractVisitor { public class DependencyCollector extends AbstractVisitor {
...@@ -41,6 +42,12 @@ public class DependencyCollector extends AbstractVisitor { ...@@ -41,6 +42,12 @@ public class DependencyCollector extends AbstractVisitor {
} }
for (FieldNode fieldNode : cls.getFields()) { for (FieldNode fieldNode : cls.getFields()) {
addDep(dex, depList, fieldNode.getType()); addDep(dex, depList, fieldNode.getType());
// process instructions from field init
FieldInitAttr fieldInitAttr = fieldNode.get(AType.FIELD_INIT);
if (fieldInitAttr != null && fieldInitAttr.getValueType() == FieldInitAttr.InitType.INSN) {
processInsn(dex, depList, fieldInitAttr.getInsn());
}
} }
// TODO: process annotations and generics // TODO: process annotations and generics
for (MethodNode methodNode : cls.getMethods()) { for (MethodNode methodNode : cls.getMethods()) {
......
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