Commit baa14e9d authored by Skylot's avatar Skylot

Handle super call processing error

parent 918e566c
...@@ -19,6 +19,7 @@ import jadx.dex.trycatch.ExcHandlerAttr; ...@@ -19,6 +19,7 @@ import jadx.dex.trycatch.ExcHandlerAttr;
import jadx.dex.trycatch.ExceptionHandler; import jadx.dex.trycatch.ExceptionHandler;
import jadx.dex.trycatch.TryCatchBlock; import jadx.dex.trycatch.TryCatchBlock;
import jadx.utils.BlockUtils; import jadx.utils.BlockUtils;
import jadx.utils.exceptions.JadxRuntimeException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -61,19 +62,25 @@ public class ModVisitor extends AbstractVisitor { ...@@ -61,19 +62,25 @@ public class ModVisitor extends AbstractVisitor {
MethodInfo callMth = inv.getCallMth(); MethodInfo callMth = inv.getCallMth();
if (callMth.isConstructor()) { if (callMth.isConstructor()) {
ConstructorInsn co = new ConstructorInsn(mth, inv); ConstructorInsn co = new ConstructorInsn(mth, inv);
// don't call 'super' if parent 'Object'
if (co.isSuper()) { if (co.isSuper()) {
if (!co.getClassType().getFullName().equals(Consts.CLASS_OBJECT)) { try {
for (int j = 0; j < co.getArgsCount(); j++) { // don't call 'super' if parent 'Object'
InsnArg arg = co.getArg(j); if (!co.getClassType().getFullName().equals(Consts.CLASS_OBJECT)) {
if (arg.isRegister()) { for (int j = 0; j < co.getArgsCount(); j++) {
CodeShrinker.inlineArgument(mth, (RegisterArg) arg); InsnArg arg = co.getArg(j);
if (arg.isRegister()) {
CodeShrinker.inlineArgument(mth, (RegisterArg) arg);
}
} }
if (!mth.getParentClass().getAccessFlags().isEnum())
mth.setSuperCall(co);
} }
if (!mth.getParentClass().getAccessFlags().isEnum()) remover.add(insn);
mth.setSuperCall(co); } catch (JadxRuntimeException e) {
// inline args into super fail
LOG.warn("Can't inline args into super call: " + inv + ", mth: " + mth);
replaceInsn(block, i, co);
} }
remover.add(insn);
} else if (co.isThis() && co.getArgsCount() == 0) { } else if (co.isThis() && co.getArgsCount() == 0) {
MethodNode defCo = mth.getParentClass().searchMethodById(co.getCallMth().getShortId()); MethodNode defCo = mth.getParentClass().searchMethodById(co.getCallMth().getShortId());
if (defCo == null || defCo.isNoCode()) { if (defCo == null || defCo.isNoCode()) {
......
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