Skip to content

Commit

Permalink
fix: don't remove synthetic method if args count or name not same (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Nov 9, 2018
1 parent 5281eed commit 20b03aa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions jadx-core/src/main/java/jadx/core/dex/visitors/ClassModifier.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jadx.core.dex.visitors;

import java.util.List;
import java.util.Objects;

import jadx.core.dex.attributes.AFlag;
import jadx.core.dex.attributes.AType;
Expand Down Expand Up @@ -216,16 +217,23 @@ private static boolean checkSyntheticWrapper(MethodNode mth, InsnNode insn) {
MethodInfo callMth = ((InvokeNode) insn).getCallMth();
MethodNode wrappedMth = mth.root().deepResolveMethod(callMth);
if (wrappedMth != null) {
if (callMth.getArgsCount() != mth.getMethodInfo().getArgsCount()) {
return false;
}
// all args must be registers passed from method args (allow only casts insns)
for (InsnArg arg : insn.getArguments()) {
if (!registersAndCastsOnly(arg)) {
return false;
}
}
String alias = mth.getAlias();
if (!wrappedMth.getAlias().equals(alias) && wrappedMth.isVirtual()) {
wrappedMth.getMethodInfo().setAlias(alias);
if (Objects.equals(wrappedMth.getAlias(), alias)) {
return true;
}
if (!wrappedMth.isVirtual()) {
return false;
}
wrappedMth.getMethodInfo().setAlias(alias);
return true;
}
}
Expand Down

0 comments on commit 20b03aa

Please sign in to comment.