fix: allow override type with wider one only from debug info (#403)
This commit is contained in:
@@ -19,6 +19,9 @@ public class TestInlineInCatch extends IntegrationTest {
|
||||
File output = null;
|
||||
try {
|
||||
output = File.createTempFile("f", "a", dir);
|
||||
if (!output.exists()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
if (output != null) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package jadx.tests.integration.types;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import jadx.core.dex.nodes.ClassNode;
|
||||
import jadx.tests.api.IntegrationTest;
|
||||
|
||||
import static jadx.tests.api.utils.JadxMatchers.containsOne;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TestPrimitivesInIf extends IntegrationTest {
|
||||
|
||||
public static class TestCls {
|
||||
|
||||
public boolean test(String str) {
|
||||
short sh = Short.parseShort(str);
|
||||
int i = Integer.parseInt(str);
|
||||
System.out.println(sh + " vs " + i);
|
||||
return sh == i;
|
||||
}
|
||||
|
||||
public void check() {
|
||||
assertTrue(test("1"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
ClassNode cls = getClassNode(TestCls.class);
|
||||
String code = cls.getCode().toString();
|
||||
|
||||
assertThat(code, containsOne("short sh = Short.parseShort(str);"));
|
||||
assertThat(code, containsOne("int i = Integer.parseInt(str);"));
|
||||
assertThat(code, containsOne("return sh == i;"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
setOutputCFG();
|
||||
noDebugInfo();
|
||||
ClassNode cls = getClassNode(TestCls.class);
|
||||
String code = cls.getCode().toString();
|
||||
|
||||
assertThat(code, containsOne("short parseShort = Short.parseShort(str);"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user