Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colcode
jadx
提交
711419a7
J
jadx
项目概览
colcode
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
711419a7
编写于
10月 02, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: correct fix for all use places of incompatible primitives (#1688)
上级
603f3057
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
74 addition
and
9 deletion
+74
-9
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeInferenceVisitor.java
...core/dex/visitors/typeinference/TypeInferenceVisitor.java
+4
-9
jadx-core/src/test/java/jadx/tests/integration/conditions/TestBooleanToInt.java
...a/jadx/tests/integration/conditions/TestBooleanToInt.java
+1
-0
jadx-core/src/test/java/jadx/tests/integration/conditions/TestBooleanToInt2.java
.../jadx/tests/integration/conditions/TestBooleanToInt2.java
+40
-0
jadx-core/src/test/smali/conditions/TestBooleanToInt2.smali
jadx-core/src/test/smali/conditions/TestBooleanToInt2.smali
+29
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeInferenceVisitor.java
浏览文件 @
711419a7
...
...
@@ -913,25 +913,20 @@ public final class TypeInferenceVisitor extends AbstractVisitor {
}
boolean
fixed
=
false
;
for
(
ITypeBound
bound
:
typeInfo
.
getBounds
())
{
if
(
bound
.
getBound
()
==
BoundEnum
.
USE
&&
fixBooleanUsage
(
mth
,
bound
))
{
for
(
RegisterArg
arg
:
new
ArrayList
<>(
var
.
getUseList
()))
{
if
(
fixBooleanUsage
(
mth
,
arg
))
{
fixed
=
true
;
}
}
return
fixed
;
}
private
boolean
fixBooleanUsage
(
MethodNode
mth
,
ITypeBound
bound
)
{
ArgType
boundType
=
bound
.
ge
tType
();
private
boolean
fixBooleanUsage
(
MethodNode
mth
,
RegisterArg
boundArg
)
{
ArgType
boundType
=
bound
Arg
.
getIni
tType
();
if
(
boundType
==
ArgType
.
BOOLEAN
||
(
boundType
.
isTypeKnown
()
&&
!
boundType
.
isPrimitive
()))
{
return
false
;
}
RegisterArg
boundArg
=
bound
.
getArg
();
if
(
boundArg
==
null
)
{
return
false
;
}
InsnNode
insn
=
boundArg
.
getParentInsn
();
if
(
insn
==
null
||
insn
.
getType
()
==
InsnType
.
IF
)
{
return
false
;
...
...
jadx-core/src/test/java/jadx/tests/integration/conditions/TestBooleanToInt.java
浏览文件 @
711419a7
...
...
@@ -6,6 +6,7 @@ import jadx.tests.api.SmaliTest;
import
static
jadx
.
tests
.
api
.
utils
.
assertj
.
JadxAssertions
.
assertThat
;
@SuppressWarnings
(
"CommentedOutCode"
)
public
class
TestBooleanToInt
extends
SmaliTest
{
// @formatter:off
...
...
jadx-core/src/test/java/jadx/tests/integration/conditions/TestBooleanToInt2.java
0 → 100644
浏览文件 @
711419a7
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);"
);
}
}
jadx-core/src/test/smali/conditions/TestBooleanToInt2.smali
0 → 100644
浏览文件 @
711419a7
.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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录