提交 dda49f15 编写于 作者: S Skylot

core: fix enum reconstruction (#272)

上级 4e2e5aa9
...@@ -16,6 +16,7 @@ import jadx.core.dex.instructions.InsnType; ...@@ -16,6 +16,7 @@ import jadx.core.dex.instructions.InsnType;
import jadx.core.dex.instructions.args.ArgType; import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.InsnArg; import jadx.core.dex.instructions.args.InsnArg;
import jadx.core.dex.instructions.args.InsnWrapArg; import jadx.core.dex.instructions.args.InsnWrapArg;
import jadx.core.dex.instructions.args.RegisterArg;
import jadx.core.dex.instructions.mods.ConstructorInsn; import jadx.core.dex.instructions.mods.ConstructorInsn;
import jadx.core.dex.nodes.BlockNode; import jadx.core.dex.nodes.BlockNode;
import jadx.core.dex.nodes.ClassNode; import jadx.core.dex.nodes.ClassNode;
...@@ -26,6 +27,7 @@ import jadx.core.dex.nodes.MethodNode; ...@@ -26,6 +27,7 @@ import jadx.core.dex.nodes.MethodNode;
import jadx.core.utils.ErrorsCounter; import jadx.core.utils.ErrorsCounter;
import jadx.core.utils.InsnUtils; import jadx.core.utils.InsnUtils;
import jadx.core.utils.exceptions.JadxException; import jadx.core.utils.exceptions.JadxException;
import org.jetbrains.annotations.Nullable;
@JadxVisitor( @JadxVisitor(
name = "EnumVisitor", name = "EnumVisitor",
...@@ -185,10 +187,18 @@ public class EnumVisitor extends AbstractVisitor { ...@@ -185,10 +187,18 @@ public class EnumVisitor extends AbstractVisitor {
} }
InsnArg arg = putInsn.getArg(0); InsnArg arg = putInsn.getArg(0);
if (arg.isInsnWrap()) { if (arg.isInsnWrap()) {
InsnNode wrapInsn = ((InsnWrapArg) arg).getWrapInsn(); return castConstructorInsn(((InsnWrapArg) arg).getWrapInsn());
if (wrapInsn.getType() == InsnType.CONSTRUCTOR) { }
return (ConstructorInsn) wrapInsn; if (arg.isRegister()) {
} return castConstructorInsn(((RegisterArg) arg).getAssignInsn());
}
return null;
}
@Nullable
private ConstructorInsn castConstructorInsn(InsnNode coCandidate) {
if (coCandidate != null && coCandidate.getType() == InsnType.CONSTRUCTOR) {
return (ConstructorInsn) coCandidate;
} }
return null; return null;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册