Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
96dea75b
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
96dea75b
编写于
12月 12, 2020
作者:
J
Jonas Konrad
提交者:
GitHub
12月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: preserve original method details in inlined invocation (PR #1049)
上级
035fce61
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
0 deletion
+48
-0
jadx-core/src/main/java/jadx/core/dex/visitors/InlineMethods.java
...e/src/main/java/jadx/core/dex/visitors/InlineMethods.java
+7
-0
jadx-core/src/test/java/jadx/tests/integration/invoke/TestCastInOverloadedAccessor.java
...ests/integration/invoke/TestCastInOverloadedAccessor.java
+41
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/InlineMethods.java
浏览文件 @
96dea75b
...
...
@@ -7,6 +7,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
jadx.core.dex.attributes.AFlag
;
import
jadx.core.dex.attributes.AType
;
import
jadx.core.dex.attributes.nodes.MethodInlineAttr
;
import
jadx.core.dex.info.MethodInfo
;
import
jadx.core.dex.instructions.InsnType
;
...
...
@@ -16,6 +17,7 @@ import jadx.core.dex.instructions.args.InsnArg;
import
jadx.core.dex.instructions.args.RegisterArg
;
import
jadx.core.dex.instructions.args.SSAVar
;
import
jadx.core.dex.nodes.BlockNode
;
import
jadx.core.dex.nodes.IMethodDetails
;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.visitors.typeinference.TypeInferenceVisitor
;
...
...
@@ -103,9 +105,14 @@ public class InlineMethods extends AbstractVisitor {
}
}
}
IMethodDetails
methodDetailsAttr
=
inlCopy
.
get
(
AType
.
METHOD_DETAILS
);
if
(!
BlockUtils
.
replaceInsn
(
mth
,
block
,
insn
,
inlCopy
))
{
mth
.
addWarnComment
(
"Failed to inline method: "
+
callMth
);
}
// replaceInsn replaces the attributes as well, make sure to preserve METHOD_DETAILS
if
(
methodDetailsAttr
!=
null
)
{
inlCopy
.
addAttr
(
methodDetailsAttr
);
}
}
private
boolean
isAssignNeeded
(
InsnNode
inlineInsn
,
InvokeNode
parentInsn
,
MethodNode
callMthNode
)
{
...
...
jadx-core/src/test/java/jadx/tests/integration/invoke/TestCastInOverloadedAccessor.java
0 → 100644
浏览文件 @
96dea75b
package
jadx.tests.integration.invoke
;
import
org.junit.jupiter.api.Test
;
import
jadx.tests.api.SmaliTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
public
class
TestCastInOverloadedAccessor
extends
SmaliTest
{
static
class
X
{
void
test
()
{
new
Runnable
()
{
@Override
public
void
run
()
{
outerMethod
(
""
);
outerMethod
(
""
,
""
);
}
};
}
private
void
outerMethod
(
String
s
)
{
}
private
void
outerMethod
(
String
s
,
String
t
)
{
}
private
void
outerMethod
(
int
a
)
{
}
private
void
outerMethod
(
int
a
,
int
b
)
{
}
}
@Test
public
void
test
()
{
String
code
=
getClassNode
(
X
.
class
).
getCode
().
getCodeStr
();
assertThat
(
code
,
containsOne
(
"outerMethod(\"\")"
));
assertThat
(
code
,
containsOne
(
"outerMethod(\"\", \"\")"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录