-
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: don't change AST before checks in ternary transform (#710)
- Loading branch information
Showing
3 changed files
with
47 additions
and
5 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
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
41 changes: 41 additions & 0 deletions
41
jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryWithEmptyCatch.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,41 @@ | ||
package jadx.tests.integration.trycatch; | ||
|
||
import java.util.Properties; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.core.dex.nodes.ClassNode; | ||
import jadx.tests.api.IntegrationTest; | ||
|
||
import static jadx.tests.api.utils.JadxMatchers.containsOne; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class TestTryWithEmptyCatch extends IntegrationTest { | ||
|
||
public static class TestCls extends Exception { | ||
private static final long serialVersionUID = -5723049816464070603L; | ||
private Properties field; | ||
|
||
public TestCls(String str) { | ||
super(str); | ||
Properties properties = null; | ||
try { | ||
if (str.contains("properties")) { | ||
properties = new Properties(); | ||
} | ||
} catch (Exception unused) { | ||
// empty | ||
} | ||
this.field = properties; | ||
} | ||
} | ||
|
||
@Test | ||
public void test() { | ||
ClassNode cls = getClassNode(TestCls.class); | ||
String code = cls.getCode().toString(); | ||
|
||
assertThat(code, containsOne("try {")); | ||
assertThat(code, containsOne("if (")); | ||
} | ||
} |