core: prevent endless region processing (#340)

This commit is contained in:
Skylot
2018-08-23 20:56:32 +03:00
parent 0c041120f6
commit 7492889f4e
4 changed files with 34 additions and 15 deletions
@@ -5,6 +5,7 @@ import org.junit.Test;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.JadxMatchers.containsLines;
import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
@@ -18,10 +19,8 @@ public class TestWrongCode extends IntegrationTest {
return a.length;
}
@SuppressWarnings("empty")
private int test2(int a) {
if (a == 0) {
;
}
return a;
}
@@ -36,7 +35,11 @@ public class TestWrongCode extends IntegrationTest {
assertThat(code, containsOne("int[] a = null;"));
assertThat(code, containsOne("return a.length;"));
assertThat(code, containsString("return a == 0 ? a : a;"));
assertThat(code, containsLines(2,
"if (a == 0) {",
"}",
"return a;"
));
}
@Test