Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
极致猎手
jadx
提交
e07332d4
J
jadx
项目概览
极致猎手
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
e07332d4
编写于
5月 21, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(gui): resolve cast exception for variable reference (#1489)
上级
bd8a44c4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
15 deletion
+24
-15
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+6
-3
jadx-core/src/main/java/jadx/api/JavaClass.java
jadx-core/src/main/java/jadx/api/JavaClass.java
+13
-3
jadx-gui/src/main/java/jadx/gui/ui/dialog/UsageDialog.java
jadx-gui/src/main/java/jadx/gui/ui/dialog/UsageDialog.java
+0
-4
jadx-gui/src/main/java/jadx/gui/utils/codecache/disk/DiskCodeCache.java
...ain/java/jadx/gui/utils/codecache/disk/DiskCodeCache.java
+1
-1
jadx-gui/src/main/java/jadx/gui/utils/codecache/disk/adapters/VarRefAdapter.java
...jadx/gui/utils/codecache/disk/adapters/VarRefAdapter.java
+4
-4
未找到文件。
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
浏览文件 @
e07332d4
...
...
@@ -683,10 +683,13 @@ public final class JadxDecompiler implements Closeable {
throw
new
JadxRuntimeException
(
"Missing code info for resolve VarRef: "
+
varRef
);
}
ICodeAnnotation
varNodeAnn
=
codeInfo
.
getCodeMetadata
().
getAt
(
varRef
.
getRefPos
());
if
(
varNodeAnn
==
null
)
{
return
null
;
if
(
varNodeAnn
!=
null
&&
varNodeAnn
.
getAnnType
()
==
ICodeAnnotation
.
AnnType
.
DECLARATION
)
{
ICodeNodeRef
nodeRef
=
((
NodeDeclareRef
)
varNodeAnn
).
getNode
();
if
(
nodeRef
.
getAnnType
()
==
ICodeAnnotation
.
AnnType
.
VAR
)
{
return
resolveVarNode
((
VarNode
)
nodeRef
);
}
}
return
(
JavaVariable
)
getJavaNodeByCodeAnnotation
(
codeInfo
,
varNodeAnn
)
;
return
null
;
}
List
<
JavaNode
>
convertNodes
(
Collection
<?
extends
ICodeNodeRef
>
nodesList
)
{
...
...
jadx-core/src/main/java/jadx/api/JavaClass.java
浏览文件 @
e07332d4
...
...
@@ -6,12 +6,16 @@ import java.util.Comparator;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
org.jetbrains.annotations.ApiStatus
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
jadx.api.metadata.ICodeAnnotation
;
import
jadx.api.metadata.ICodeAnnotation.AnnType
;
import
jadx.api.metadata.ICodeNodeRef
;
import
jadx.core.dex.attributes.AFlag
;
import
jadx.core.dex.attributes.AType
;
...
...
@@ -22,6 +26,7 @@ import jadx.core.dex.nodes.FieldNode;
import
jadx.core.dex.nodes.MethodNode
;
public
final
class
JavaClass
implements
JavaNode
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
JavaClass
.
class
);
private
final
JadxDecompiler
decompiler
;
private
final
ClassNode
cls
;
...
...
@@ -196,12 +201,17 @@ public final class JavaClass implements JavaNode {
List
<
Integer
>
result
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
ICodeAnnotation
>
entry
:
map
.
entrySet
())
{
ICodeAnnotation
ann
=
entry
.
getValue
();
if
(
ann
.
getAnnType
()
==
ICodeAnnotation
.
AnnType
.
DECLARATION
)
{
// ignore declarations
AnnType
annType
=
ann
.
getAnnType
();
if
(
annType
==
AnnType
.
DECLARATION
||
annType
==
AnnType
.
OFFSET
)
{
// ignore declarations and offset annotations
continue
;
}
// ignore declarations
JavaNode
annNode
=
rootDec
.
getJavaNodeByCodeAnnotation
(
codeInfo
,
ann
);
if
(
javaNode
.
equals
(
annNode
))
{
if
(
annNode
==
null
&&
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Failed to resolve code annotation, cls: {}, pos: {}, ann: {}"
,
this
,
entry
.
getKey
(),
ann
);
}
if
(
Objects
.
equals
(
annNode
,
javaNode
))
{
result
.
add
(
entry
.
getKey
());
}
}
...
...
jadx-gui/src/main/java/jadx/gui/ui/dialog/UsageDialog.java
浏览文件 @
e07332d4
...
...
@@ -100,10 +100,6 @@ public class UsageDialog extends CommonSearchDialog {
JadxDecompiler
decompiler
=
mainWindow
.
getWrapper
().
getDecompiler
();
List
<
Integer
>
usePositions
=
topUseClass
.
getUsePlacesFor
(
codeInfo
,
searchNode
);
for
(
int
pos
:
usePositions
)
{
if
(
searchNode
.
getTopParentClass
().
equals
(
topUseClass
)
&&
pos
==
searchNode
.
getDefPos
())
{
// skip declaration
continue
;
}
String
line
=
CodeUtils
.
getLineForPos
(
code
,
pos
);
if
(
line
.
startsWith
(
"import "
))
{
continue
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/codecache/disk/DiskCodeCache.java
浏览文件 @
e07332d4
...
...
@@ -37,7 +37,7 @@ import jadx.core.utils.files.FileUtils;
public
class
DiskCodeCache
implements
ICodeCache
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
DiskCodeCache
.
class
);
private
static
final
int
DATA_FORMAT_VERSION
=
7
;
private
static
final
int
DATA_FORMAT_VERSION
=
8
;
private
final
Path
srcDir
;
private
final
Path
metaDir
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/codecache/disk/adapters/VarRefAdapter.java
浏览文件 @
e07332d4
...
...
@@ -13,14 +13,14 @@ public class VarRefAdapter extends BaseDataAdapter<VarRef> {
@Override
public
void
write
(
DataOutput
out
,
VarRef
value
)
throws
IOException
{
int
refPos
=
value
.
getRefPos
();
if
(
refPos
=
=
0
)
{
throw
new
RuntimeException
(
"Variable refPos is
zero
: "
+
value
);
if
(
refPos
<
=
0
)
{
throw
new
RuntimeException
(
"Variable refPos is
invalid
: "
+
value
);
}
out
.
write
Shor
t
(
refPos
);
out
.
write
In
t
(
refPos
);
}
@Override
public
VarRef
read
(
DataInput
in
)
throws
IOException
{
return
VarRef
.
fromPos
(
in
.
read
Shor
t
());
return
VarRef
.
fromPos
(
in
.
read
In
t
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录