Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
b5344f45
J
jadx
项目概览
Quincy379
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
b5344f45
编写于
3月 29, 2019
作者:
A
Ahmed Ashour
提交者:
skylot
3月 29, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: redundant byte and short cast (#538) (PR #539)
上级
0fa3842a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
80 addition
and
3 deletion
+80
-3
jadx-core/src/main/java/jadx/core/codegen/TypeGen.java
jadx-core/src/main/java/jadx/core/codegen/TypeGen.java
+2
-2
jadx-core/src/test/java/jadx/tests/integration/arrays/TestRedundantType.java
...java/jadx/tests/integration/arrays/TestRedundantType.java
+77
-0
jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver4.java
.../java/jadx/tests/integration/types/TestTypeResolver4.java
+1
-1
未找到文件。
jadx-core/src/main/java/jadx/core/codegen/TypeGen.java
浏览文件 @
b5344f45
...
...
@@ -97,7 +97,7 @@ public class TypeGen {
if
(
s
==
Short
.
MIN_VALUE
)
{
return
"Short.MIN_VALUE"
;
}
return
"(short) "
+
s
;
return
Short
.
toString
(
s
)
;
}
public
static
String
formatByte
(
byte
b
)
{
...
...
@@ -107,7 +107,7 @@ public class TypeGen {
if
(
b
==
Byte
.
MIN_VALUE
)
{
return
"Byte.MIN_VALUE"
;
}
return
"(byte) "
+
b
;
return
Byte
.
toString
(
b
)
;
}
public
static
String
formatInteger
(
int
i
)
{
...
...
jadx-core/src/test/java/jadx/tests/integration/arrays/TestRedundantType.java
0 → 100644
浏览文件 @
b5344f45
package
jadx.tests.integration.arrays
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
org.junit.jupiter.api.Test
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
static
org
.
hamcrest
.
CoreMatchers
.
containsString
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
public
class
TestRedundantType
extends
IntegrationTest
{
public
static
class
TestCls
{
public
byte
[]
method
()
{
return
new
byte
[]{
10
,
11
,
12
};
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsString
(
"return new byte[]{10, 11, 12};"
));
}
public
static
class
TestByte
{
public
byte
[]
method
()
{
byte
[]
arr
=
new
byte
[
50
];
arr
[
10
]
=
126
;
arr
[
20
]
=
127
;
arr
[
30
]
=
(
byte
)
128
;
arr
[
40
]
=
(
byte
)
129
;
return
arr
;
}
}
@Test
public
void
testByte
()
{
ClassNode
cls
=
getClassNode
(
TestByte
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsString
(
"arr[10] = 126"
));
assertThat
(
code
,
containsString
(
"arr[20] = Byte.MAX_VALUE"
));
assertThat
(
code
,
containsString
(
"arr[30] = Byte.MIN_VALUE"
));
assertThat
(
code
,
containsString
(
"arr[40] = -127"
));
assertEquals
(-
127
,
new
TestByte
().
method
()[
40
]);
}
public
static
class
TestShort
{
public
short
[]
method
()
{
short
[]
arr
=
new
short
[
50
];
arr
[
10
]
=
32766
;
arr
[
20
]
=
32767
;
arr
[
30
]
=
(
short
)
32768
;
arr
[
40
]
=
(
short
)
32769
;
return
arr
;
}
}
@Test
public
void
testShort
()
{
ClassNode
cls
=
getClassNode
(
TestShort
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsString
(
"arr[10] = 32766"
));
assertThat
(
code
,
containsString
(
"arr[20] = Short.MAX_VALUE"
));
assertThat
(
code
,
containsString
(
"arr[30] = Short.MIN_VALUE"
));
assertThat
(
code
,
containsString
(
"arr[40] = -32767"
));
assertEquals
(-
32767
,
new
TestShort
().
method
()[
40
]);
}
}
jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver4.java
浏览文件 @
b5344f45
...
...
@@ -41,7 +41,7 @@ public class TestTypeResolver4 extends IntegrationTest {
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"(strArray[end] !=
(byte) 0 || strArray[end + 1] != (byte)
0)"
));
assertThat
(
code
,
containsOne
(
"(strArray[end] !=
0 || strArray[end + 1] !=
0)"
));
}
@Test
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录