core: fixed invoke arguments list (fix #61)
This commit is contained in:
@@ -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(')');
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
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);"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user