Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ql04210214
jadx
提交
9e811d95
J
jadx
项目概览
ql04210214
/
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,发现更多精彩内容 >>
提交
9e811d95
编写于
8月 16, 2014
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: add method for print line numbers
上级
957d5394
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
13 deletion
+32
-13
jadx-core/src/main/java/jadx/core/codegen/CodeWriter.java
jadx-core/src/main/java/jadx/core/codegen/CodeWriter.java
+25
-0
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+2
-5
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
+2
-2
jadx-core/src/main/java/jadx/core/codegen/RegionGen.java
jadx-core/src/main/java/jadx/core/codegen/RegionGen.java
+3
-6
未找到文件。
jadx-core/src/main/java/jadx/core/codegen/CodeWriter.java
浏览文件 @
9e811d95
...
...
@@ -22,6 +22,8 @@ public class CodeWriter {
public
static
final
String
NL
=
System
.
getProperty
(
"line.separator"
);
public
static
final
String
INDENT
=
" "
;
private
static
final
boolean
ADD_LINE_NUMBERS
=
false
;
private
static
final
String
[]
INDENT_CACHE
=
{
""
,
INDENT
,
...
...
@@ -43,6 +45,9 @@ public class CodeWriter {
public
CodeWriter
()
{
this
.
indent
=
0
;
this
.
indentStr
=
""
;
if
(
ADD_LINE_NUMBERS
)
{
incIndent
(
2
);
}
}
public
CodeWriter
startLine
()
{
...
...
@@ -65,6 +70,26 @@ public class CodeWriter {
return
this
;
}
public
CodeWriter
startLineWithNum
(
int
sourceLine
)
{
if
(
sourceLine
==
0
)
{
startLine
();
return
this
;
}
if
(
ADD_LINE_NUMBERS
)
{
newLine
();
attachSourceLine
(
sourceLine
);
String
ln
=
"/* "
+
sourceLine
+
" */ "
;
add
(
ln
);
if
(
indentStr
.
length
()
>
ln
.
length
())
{
add
(
indentStr
.
substring
(
ln
.
length
()));
}
}
else
{
startLine
();
attachSourceLine
(
sourceLine
);
}
return
this
;
}
public
CodeWriter
add
(
String
str
)
{
buf
.
append
(
str
);
offset
+=
str
.
length
();
...
...
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
浏览文件 @
9e811d95
...
...
@@ -196,10 +196,7 @@ public class InsnGen {
state
.
add
(
flag
);
makeInsnBody
(
code
,
insn
,
state
);
}
else
{
code
.
startLine
();
if
(
insn
.
getSourceLine
()
!=
0
)
{
code
.
attachSourceLine
(
insn
.
getSourceLine
());
}
code
.
startLineWithNum
(
insn
.
getSourceLine
());
if
(
insn
.
getResult
()
!=
null
&&
insn
.
getType
()
!=
InsnType
.
ARITH_ONEARG
)
{
assignVar
(
code
,
insn
);
code
.
add
(
" = "
);
...
...
@@ -304,7 +301,7 @@ public class InsnGen {
addArg
(
code
,
insn
.
getArg
(
0
));
code
.
add
(
" == "
);
addArg
(
code
,
insn
.
getArg
(
1
));
code
.
add
(
"? 0 : -1))"
);
code
.
add
(
"
? 0 : -1))"
);
break
;
case
INSTANCE_OF:
{
...
...
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
浏览文件 @
9e811d95
...
...
@@ -78,8 +78,8 @@ public class MethodGen {
if
(
clsAccFlags
.
isAnnotation
())
{
ai
=
ai
.
remove
(
AccessFlags
.
ACC_PUBLIC
);
}
code
.
startLine
(
ai
.
makeString
());
code
.
a
ttachSourceLine
(
mth
.
getSourceLine
());
code
.
startLine
WithNum
(
mth
.
getSourceLine
());
code
.
a
dd
(
ai
.
makeString
());
if
(
classGen
.
addGenericMap
(
code
,
mth
.
getGenericMap
()))
{
code
.
add
(
' '
);
...
...
jadx-core/src/main/java/jadx/core/codegen/RegionGen.java
浏览文件 @
9e811d95
...
...
@@ -101,14 +101,11 @@ public class RegionGen extends InsnGen {
}
private
void
makeIf
(
IfRegion
region
,
CodeWriter
code
,
boolean
newLine
)
throws
CodegenException
{
if
(
region
.
getTernRegion
()
!=
null
)
{
makeSimpleBlock
(
region
.
getTernRegion
().
getBlock
(),
code
);
return
;
}
if
(
newLine
)
{
code
.
startLine
();
code
.
startLineWithNum
(
region
.
getSourceLine
());
}
else
{
code
.
attachSourceLine
(
region
.
getSourceLine
());
}
code
.
attachSourceLine
(
region
.
getSourceLine
());
code
.
add
(
"if ("
);
new
ConditionGen
(
this
).
add
(
code
,
region
.
getCondition
());
code
.
add
(
") {"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录