Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
fe248d70
J
jadx
项目概览
keyescgm
/
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,发现更多精彩内容 >>
未验证
提交
fe248d70
编写于
2月 14, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: check values in inner class annotation (#1382)
上级
1a2e702b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
6 deletion
+31
-6
jadx-plugins/jadx-dex-input/src/main/java/jadx/plugins/input/dex/sections/DexAnnotationsConvert.java
...adx/plugins/input/dex/sections/DexAnnotationsConvert.java
+11
-6
jadx-plugins/jadx-dex-input/src/main/java/jadx/plugins/input/dex/sections/annotations/AnnotationsUtils.java
...gins/input/dex/sections/annotations/AnnotationsUtils.java
+20
-0
未找到文件。
jadx-plugins/jadx-dex-input/src/main/java/jadx/plugins/input/dex/sections/DexAnnotationsConvert.java
浏览文件 @
fe248d70
...
...
@@ -2,7 +2,6 @@ package jadx.plugins.input.dex.sections;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.slf4j.Logger
;
...
...
@@ -20,6 +19,7 @@ import jadx.api.plugins.input.data.attributes.types.InnerClassesAttr;
import
jadx.api.plugins.input.data.attributes.types.InnerClsInfo
;
import
jadx.api.plugins.input.data.attributes.types.SignatureAttr
;
import
jadx.api.plugins.utils.Utils
;
import
jadx.plugins.input.dex.sections.annotations.AnnotationsUtils
;
public
class
DexAnnotationsConvert
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
DexAnnotationsConvert
.
class
);
...
...
@@ -56,11 +56,16 @@ public class DexAnnotationsConvert {
break
;
case
"Ldalvik/annotation/InnerClass;"
:
Map
<
String
,
EncodedValue
>
values
=
annotation
.
getValues
();
String
name
=
(
String
)
values
.
get
(
"name"
).
getValue
();
int
accFlags
=
(
Integer
)
values
.
get
(
"accessFlags"
).
getValue
();
Map
<
String
,
InnerClsInfo
>
map
=
Collections
.
singletonMap
(
cls
,
new
InnerClsInfo
(
cls
,
null
,
name
,
accFlags
));
attributes
.
add
(
new
InnerClassesAttr
(
map
));
try
{
String
name
=
AnnotationsUtils
.
getValue
(
annotation
,
"name"
,
EncodedType
.
ENCODED_STRING
,
null
);
int
accFlags
=
AnnotationsUtils
.
getValue
(
annotation
,
"accessFlags"
,
EncodedType
.
ENCODED_INT
,
0
);
if
(
name
!=
null
||
accFlags
!=
0
)
{
InnerClsInfo
innerClsInfo
=
new
InnerClsInfo
(
cls
,
null
,
name
,
accFlags
);
attributes
.
add
(
new
InnerClassesAttr
(
Collections
.
singletonMap
(
cls
,
innerClsInfo
)));
}
}
catch
(
Exception
e
)
{
LOG
.
warn
(
"Failed to parse annotation: "
+
annotation
,
e
);
}
break
;
case
"Ldalvik/annotation/AnnotationDefault;"
:
...
...
jadx-plugins/jadx-dex-input/src/main/java/jadx/plugins/input/dex/sections/annotations/AnnotationsUtils.java
0 → 100644
浏览文件 @
fe248d70
package
jadx.plugins.input.dex.sections.annotations
;
import
jadx.api.plugins.input.data.annotations.EncodedType
;
import
jadx.api.plugins.input.data.annotations.EncodedValue
;
import
jadx.api.plugins.input.data.annotations.IAnnotation
;
public
class
AnnotationsUtils
{
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
getValue
(
IAnnotation
ann
,
String
name
,
EncodedType
type
,
T
defValue
)
{
if
(
ann
==
null
||
ann
.
getValues
()
==
null
||
ann
.
getValues
().
isEmpty
())
{
return
defValue
;
}
EncodedValue
encodedValue
=
ann
.
getValues
().
get
(
name
);
if
(
encodedValue
==
null
||
encodedValue
.
getType
()
!=
type
)
{
return
defValue
;
}
return
(
T
)
encodedValue
.
getValue
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录