-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct method exit blocks collection (#876)
- Loading branch information
Showing
2 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
jadx-core/src/test/java/jadx/tests/integration/switches/TestSwitchWithThrow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package jadx.tests.integration.switches; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.tests.api.IntegrationTest; | ||
|
||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; | ||
|
||
public class TestSwitchWithThrow extends IntegrationTest { | ||
|
||
public static class TestCls { | ||
public int test(int i) { | ||
if (i != 0) { | ||
switch (i % 4) { | ||
case 1: | ||
throw new IllegalStateException("1"); | ||
case 2: | ||
throw new IllegalStateException("2"); | ||
default: | ||
throw new IllegalStateException("Other"); | ||
} | ||
} else { | ||
System.out.println("0"); | ||
return -1; | ||
} | ||
} | ||
|
||
public void check() { | ||
assertThat(test(0)).isEqualTo(-1); | ||
// TODO: implement 'invoke-custom' support | ||
// assertThat(catchThrowable(() -> test(1))) | ||
// .isInstanceOf(IllegalStateException.class).hasMessageContaining("1"); | ||
// assertThat(catchThrowable(() -> test(3))) | ||
// .isInstanceOf(IllegalStateException.class).hasMessageContaining("Other"); | ||
} | ||
} | ||
|
||
@Test | ||
public void test() { | ||
assertThat(getClassNode(TestCls.class)) | ||
.code() | ||
.contains("throw new IllegalStateException(\"1\");"); | ||
} | ||
} |
4cdad0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the issue despite am using the latest version,
ERROR: [69] JadxOverflowException in pass: RegionMakerVisitor in method: okhttp3.HttpUrl.Builder.resolvePath(java.lang.String, int, int):void, file: classes2.dex, details: Regions count limit reached