-
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 fix for all use places of incompatible primitives (#1688)
- Loading branch information
Showing
4 changed files
with
74 additions
and
9 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
40 changes: 40 additions & 0 deletions
40
jadx-core/src/test/java/jadx/tests/integration/conditions/TestBooleanToInt2.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,40 @@ | ||
package jadx.tests.integration.conditions; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.tests.api.SmaliTest; | ||
|
||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; | ||
|
||
@SuppressWarnings("CommentedOutCode") | ||
public class TestBooleanToInt2 extends SmaliTest { | ||
|
||
// @formatter:off | ||
/* | ||
public static class TestCls { | ||
public void test() { | ||
boolean v = getValue(); | ||
use1(Integer.valueOf(v)); | ||
use2(v); | ||
} | ||
private boolean getValue() { | ||
return false; | ||
} | ||
private void use1(Integer v) { | ||
} | ||
private void use2(int v) { | ||
} | ||
} | ||
*/ | ||
// @formatter:on | ||
@Test | ||
public void test() { | ||
assertThat(getClassNodeFromSmali()) | ||
.code() | ||
.containsOne("use1(Integer.valueOf(value ? 1 : 0));") | ||
.containsOne("use2(value ? 1 : 0);"); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
jadx-core/src/test/smali/conditions/TestBooleanToInt2.smali
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,29 @@ | ||
.class public Lconditions/TestBooleanToInt2; | ||
.super Ljava/lang/Object; | ||
|
||
.method public test()V | ||
.registers 3 | ||
invoke-direct {p0}, Lconditions/TestBooleanToInt2;->getValue()Z | ||
move-result v0 | ||
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; | ||
move-result-object v1 | ||
invoke-direct {p0, v1}, Lconditions/TestBooleanToInt2;->use1(Ljava/lang/Integer;)V | ||
invoke-direct {p0, v0}, Lconditions/TestBooleanToInt2;->use2(I)V | ||
return-void | ||
.end method | ||
|
||
.method private getValue()Z | ||
.registers 2 | ||
const/4 v0, 0x0 | ||
return v0 | ||
.end method | ||
|
||
.method private use1(Ljava/lang/Integer;)V | ||
.registers 2 | ||
return-void | ||
.end method | ||
|
||
.method private use2(I)V | ||
.registers 2 | ||
return-void | ||
.end method |