@@ -762,7 +762,10 @@ public class InsnGen {
|
||||
}
|
||||
}
|
||||
ArgType argType = arg.getType();
|
||||
if (argType.equals(origType)) {
|
||||
if (argType.equals(origType)
|
||||
// null cast to object
|
||||
&& (!arg.isLiteral() || ((LiteralArg) arg).getLiteral() != 0
|
||||
|| (!argType.isArray() && !argType.isObject()))) {
|
||||
return false;
|
||||
}
|
||||
if (origType.isGeneric()) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package jadx.tests.integration.others;
|
||||
|
||||
import static jadx.tests.api.utils.JadxMatchers.containsOne;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.NotYetImplemented;
|
||||
import jadx.core.dex.nodes.ClassNode;
|
||||
import jadx.tests.api.IntegrationTest;
|
||||
|
||||
public class TestCastOfNull extends IntegrationTest {
|
||||
|
||||
public static class TestCls {
|
||||
|
||||
public void test() {
|
||||
m((long[]) null);
|
||||
m((String) null);
|
||||
}
|
||||
|
||||
public void m(long[] a) {
|
||||
}
|
||||
public void m(String s) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
ClassNode cls = getClassNode(TestCls.class);
|
||||
String code = cls.getCode().toString();
|
||||
|
||||
assertThat(code, containsOne("m((long[]) null);"));
|
||||
assertThat(code, containsOne("m((String) null);"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user