Commit 78b39a60 authored by Skylot's avatar Skylot

core: fixed invoke arguments list (fix #61)

parent 932966b6
......@@ -640,6 +640,7 @@ public class InsnGen {
}
int argsCount = insn.getArgsCount();
code.add('(');
boolean firstArg = true;
if (k < argsCount) {
boolean overloaded = callMth != null && callMth.isArgsOverload();
for (int i = k; i < argsCount; i++) {
......@@ -651,7 +652,7 @@ public class InsnGen {
if (callArg != null && callArg.contains(AFlag.SKIP_ARG)) {
continue;
}
if (i != k) {
if (!firstArg) {
code.add(", ");
}
boolean cast = overloaded && processOverloadedArg(code, callMth, arg, i - startArgNum);
......@@ -659,6 +660,7 @@ public class InsnGen {
continue;
}
addArg(code, arg, false);
firstArg = false;
}
}
code.add(')');
......
package jadx.tests.integration.invoke;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import org.junit.Test;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
public class TestConstructorInvoke extends IntegrationTest {
public class TestCls {
void test(String root, String name) {
ViewHolder viewHolder = new ViewHolder(root, name);
}
private final class ViewHolder {
private int mElements = 0;
private final String mRoot;
private String mName;
private ViewHolder(String root, String name) {
this.mRoot = root;
this.mName = name;
}
}
}
@Test
public void test() {
ClassNode cls = getClassNode(TestConstructorInvoke.class);
String code = cls.getCode().toString();
assertThat(code, containsString("new ViewHolder(root, name);"));
}
}
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