Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
5557fd81
Commit
5557fd81
authored
Mar 02, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some code style issues
parent
b1dc26ee
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
136 additions
and
119 deletions
+136
-119
CodeWriter.java
jadx-core/src/main/java/jadx/core/codegen/CodeWriter.java
+15
-10
ConditionGen.java
jadx-core/src/main/java/jadx/core/codegen/ConditionGen.java
+1
-2
InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+9
-8
MethodGen.java
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
+5
-9
AttributeType.java
...src/main/java/jadx/core/dex/attributes/AttributeType.java
+4
-4
AttributesList.java
...rc/main/java/jadx/core/dex/attributes/AttributesList.java
+1
-4
ClassInfo.java
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
+14
-13
FieldInfo.java
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
+6
-6
MethodInfo.java
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
+4
-4
ArithOp.java
...ore/src/main/java/jadx/core/dex/instructions/ArithOp.java
+2
-2
ArgType.java
...rc/main/java/jadx/core/dex/instructions/args/ArgType.java
+4
-4
InsnWrapArg.java
...ain/java/jadx/core/dex/instructions/args/InsnWrapArg.java
+2
-2
BlockNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/BlockNode.java
+1
-1
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+1
-1
AnnotationsParser.java
...in/java/jadx/core/dex/nodes/parser/AnnotationsParser.java
+6
-6
IfCondition.java
...core/src/main/java/jadx/core/dex/regions/IfCondition.java
+25
-25
CodeShrinker.java
...re/src/main/java/jadx/core/dex/visitors/CodeShrinker.java
+5
-5
CheckRegions.java
...ain/java/jadx/core/dex/visitors/regions/CheckRegions.java
+1
-1
CleanRegions.java
...ain/java/jadx/core/dex/visitors/regions/CleanRegions.java
+4
-1
BlockUtils.java
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
+3
-0
InsnList.java
jadx-core/src/main/java/jadx/core/utils/InsnList.java
+6
-6
InsnUtils.java
jadx-core/src/main/java/jadx/core/utils/InsnUtils.java
+3
-0
RegionUtils.java
jadx-core/src/main/java/jadx/core/utils/RegionUtils.java
+3
-0
StringUtils.java
jadx-core/src/main/java/jadx/core/utils/StringUtils.java
+3
-0
Utils.java
jadx-core/src/main/java/jadx/core/utils/Utils.java
+1
-0
TestLineNumbers.java
...re/src/test/java/jadx/tests/internal/TestLineNumbers.java
+1
-1
TestConditions2.java
.../java/jadx/tests/internal/conditions/TestConditions2.java
+1
-1
TestInline.java
.../src/test/java/jadx/tests/internal/inline/TestInline.java
+1
-1
TestInline2.java
...src/test/java/jadx/tests/internal/inline/TestInline2.java
+1
-1
TestInline6.java
...src/test/java/jadx/tests/internal/inline/TestInline6.java
+0
-1
TextNode.java
jadx-gui/src/main/java/jadx/gui/treemodel/TextNode.java
+3
-0
No files found.
jadx-core/src/main/java/jadx/core/codegen/CodeWriter.java
View file @
5557fd81
...
...
@@ -19,6 +19,15 @@ public class CodeWriter {
public
static
final
String
NL
=
System
.
getProperty
(
"line.separator"
);
public
static
final
String
INDENT
=
"\t"
;
private
static
final
String
[]
INDENT_CACHE
=
{
""
,
INDENT
,
INDENT
+
INDENT
,
INDENT
+
INDENT
+
INDENT
,
INDENT
+
INDENT
+
INDENT
+
INDENT
,
INDENT
+
INDENT
+
INDENT
+
INDENT
+
INDENT
,
};
private
final
StringBuilder
buf
=
new
StringBuilder
();
private
String
indentStr
;
private
int
indent
;
...
...
@@ -66,6 +75,11 @@ public class CodeWriter {
return
this
;
}
public
CodeWriter
add
(
Object
obj
)
{
buf
.
append
(
obj
);
return
this
;
}
public
CodeWriter
add
(
String
str
)
{
buf
.
append
(
str
);
return
this
;
...
...
@@ -116,18 +130,9 @@ public class CodeWriter {
return
this
;
}
private
static
final
String
[]
INDENT_CACHE
=
{
""
,
INDENT
,
INDENT
+
INDENT
,
INDENT
+
INDENT
+
INDENT
,
INDENT
+
INDENT
+
INDENT
+
INDENT
,
INDENT
+
INDENT
+
INDENT
+
INDENT
+
INDENT
,
};
private
void
updateIndent
()
{
int
curIndent
=
indent
;
if
(
curIndent
<
6
)
{
if
(
curIndent
<
INDENT_CACHE
.
length
)
{
this
.
indentStr
=
INDENT_CACHE
[
curIndent
];
}
else
{
StringBuilder
s
=
new
StringBuilder
(
curIndent
*
INDENT
.
length
());
...
...
jadx-core/src/main/java/jadx/core/codegen/ConditionGen.java
View file @
5557fd81
...
...
@@ -81,8 +81,7 @@ public class ConditionGen {
}
InsnNode
insn
=
((
InsnWrapArg
)
arg
).
getWrapInsn
();
if
(
insn
.
getType
()
==
InsnType
.
ARITH
)
{
ArithNode
arith
=
((
ArithNode
)
insn
);
switch
(
arith
.
getOp
())
{
switch
(((
ArithNode
)
insn
).
getOp
())
{
case
ADD:
case
SUB:
case
MUL:
...
...
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
View file @
5557fd81
...
...
@@ -255,14 +255,14 @@ public class InsnGen {
case
CAST:
{
boolean
wrap
=
state
.
contains
(
IGState
.
BODY_ONLY
);
if
(
wrap
)
{
code
.
add
(
"("
);
code
.
add
(
'('
);
}
code
.
add
(
"("
);
code
.
add
(
useType
((
(
ArgType
)
((
IndexInsnNode
)
insn
).
getIndex
()
)));
code
.
add
(
'('
);
code
.
add
(
useType
((
ArgType
)
((
IndexInsnNode
)
insn
).
getIndex
(
)));
code
.
add
(
") "
);
addArg
(
code
,
insn
.
getArg
(
0
),
true
);
if
(
wrap
)
{
code
.
add
(
")"
);
code
.
add
(
')'
);
}
break
;
}
...
...
@@ -461,10 +461,11 @@ public class InsnGen {
code
.
add
(
"switch("
).
add
(
arg
(
insn
,
0
)).
add
(
") {"
);
code
.
incIndent
();
for
(
int
i
=
0
;
i
<
sw
.
getCasesCount
();
i
++)
{
code
.
startLine
(
"case "
+
sw
.
getKeys
()[
i
]
+
": goto "
+
MethodGen
.
getLabelName
(
sw
.
getTargets
()[
i
])
+
";"
);
code
.
startLine
(
"case "
).
add
(
sw
.
getKeys
()[
i
]).
add
(
": goto "
);
code
.
add
(
MethodGen
.
getLabelName
(
sw
.
getTargets
()[
i
])).
add
(
';'
);
}
code
.
startLine
(
"default: goto "
+
MethodGen
.
getLabelName
(
sw
.
getDefaultCaseOffset
())
+
";"
);
code
.
startLine
(
"default: goto "
);
code
.
add
(
MethodGen
.
getLabelName
(
sw
.
getDefaultCaseOffset
())).
add
(
';'
);
code
.
decIndent
();
code
.
startLine
(
'}'
);
state
.
add
(
IGState
.
NO_SEMICOLON
);
...
...
@@ -719,7 +720,7 @@ public class InsnGen {
code
.
add
(
cond
);
}
else
{
if
(
state
.
contains
(
IGState
.
BODY_ONLY
))
{
code
.
add
(
"(("
).
add
(
cond
).
add
(
')'
).
add
(
" ? "
).
add
(
th
).
add
(
" : "
).
add
(
els
).
add
(
")"
);
code
.
add
(
"(("
).
add
(
cond
).
add
(
')'
).
add
(
" ? "
).
add
(
th
).
add
(
" : "
).
add
(
els
).
add
(
')'
);
}
else
{
code
.
add
(
'('
).
add
(
cond
).
add
(
')'
).
add
(
" ? "
).
add
(
th
).
add
(
" : "
).
add
(
els
);
}
...
...
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
View file @
5557fd81
...
...
@@ -168,18 +168,14 @@ public class MethodGen {
if
(
fallback
)
{
if
(
name
!=
null
)
{
return
base
+
"_"
+
name
;
}
else
{
return
base
;
}
return
base
;
}
else
{
if
(
name
!=
null
)
{
if
(
name
.
equals
(
"this"
))
{
return
name
;
}
else
if
(
Consts
.
DEBUG
)
{
return
name
+
"_"
+
base
;
}
else
{
return
name
;
if
(
Consts
.
DEBUG
)
{
return
base
+
"_"
+
name
;
}
return
name
;
}
else
{
ArgType
type
=
arg
.
getType
();
if
(
type
.
isPrimitive
())
{
...
...
@@ -274,7 +270,7 @@ public class MethodGen {
public
void
addFallbackMethodCode
(
CodeWriter
code
)
{
if
(
mth
.
getInstructions
()
==
null
)
{
// load
File
original instructions
// load original instructions
try
{
mth
.
load
();
DepthTraverser
.
visit
(
new
FallbackModeVisitor
(),
mth
);
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AttributeType.java
View file @
5557fd81
...
...
@@ -34,6 +34,10 @@ public enum AttributeType {
private
static
final
int
NOT_UNIQ_COUNT
;
private
final
boolean
uniq
;
private
AttributeType
(
boolean
isUniq
)
{
this
.
uniq
=
isUniq
;
}
static
{
// place all not unique attributes at first
int
last
=
-
1
;
...
...
@@ -51,10 +55,6 @@ public enum AttributeType {
return
NOT_UNIQ_COUNT
;
}
private
AttributeType
(
boolean
isUniq
)
{
this
.
uniq
=
isUniq
;
}
public
boolean
isUniq
()
{
return
uniq
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/AttributesList.java
View file @
5557fd81
...
...
@@ -109,10 +109,7 @@ public final class AttributesList {
public
Annotation
getAnnotation
(
String
cls
)
{
AnnotationsList
aList
=
(
AnnotationsList
)
get
(
AttributeType
.
ANNOTATION_LIST
);
if
(
aList
==
null
||
aList
.
size
()
==
0
)
{
return
null
;
}
return
aList
.
get
(
cls
);
return
aList
==
null
?
null
:
aList
.
get
(
cls
);
}
public
List
<
IAttribute
>
getAll
(
AttributeType
type
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
View file @
5557fd81
...
...
@@ -13,6 +13,20 @@ public final class ClassInfo {
private
static
final
Map
<
ArgType
,
ClassInfo
>
CLASSINFO_CACHE
=
new
WeakHashMap
<
ArgType
,
ClassInfo
>();
private
final
ArgType
type
;
private
String
pkg
;
private
String
name
;
private
String
fullName
;
// for inner class not equals null
private
ClassInfo
parentClass
;
private
ClassInfo
(
ArgType
type
)
{
assert
type
.
isObject
()
:
"Not class type: "
+
type
;
this
.
type
=
type
;
splitNames
(
true
);
}
public
static
ClassInfo
fromDex
(
DexNode
dex
,
int
clsIndex
)
{
if
(
clsIndex
==
DexNode
.
NO_INDEX
)
{
return
null
;
...
...
@@ -41,19 +55,6 @@ public final class ClassInfo {
CLASSINFO_CACHE
.
clear
();
}
private
final
ArgType
type
;
private
String
pkg
;
private
String
name
;
private
String
fullName
;
private
ClassInfo
parentClass
;
// not equals null if this is inner class
private
ClassInfo
(
ArgType
type
)
{
assert
type
.
isObject
()
:
"Not class type: "
+
type
;
this
.
type
=
type
;
splitNames
(
true
);
}
private
void
splitNames
(
boolean
canBeInner
)
{
String
fullObjectName
=
type
.
getObject
();
assert
fullObjectName
.
indexOf
(
'/'
)
==
-
1
:
"Raw type: "
+
type
;
...
...
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
View file @
5557fd81
...
...
@@ -11,6 +11,12 @@ public class FieldInfo {
private
final
String
name
;
private
final
ArgType
type
;
public
FieldInfo
(
ClassInfo
declClass
,
String
name
,
ArgType
type
)
{
this
.
declClass
=
declClass
;
this
.
name
=
name
;
this
.
type
=
type
;
}
public
static
FieldInfo
fromDex
(
DexNode
dex
,
int
index
)
{
FieldId
field
=
dex
.
getFieldId
(
index
);
return
new
FieldInfo
(
...
...
@@ -19,12 +25,6 @@ public class FieldInfo {
dex
.
getType
(
field
.
getTypeIndex
()));
}
public
FieldInfo
(
ClassInfo
declClass
,
String
name
,
ArgType
type
)
{
this
.
declClass
=
declClass
;
this
.
name
=
name
;
this
.
type
=
type
;
}
public
static
String
getNameById
(
DexNode
dex
,
int
ind
)
{
return
dex
.
getString
(
dex
.
getFieldId
(
ind
).
getNameIndex
());
}
...
...
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
View file @
5557fd81
...
...
@@ -18,10 +18,6 @@ public final class MethodInfo {
private
final
ClassInfo
declClass
;
private
final
String
shortId
;
public
static
MethodInfo
fromDex
(
DexNode
dex
,
int
mthIndex
)
{
return
new
MethodInfo
(
dex
,
mthIndex
);
}
private
MethodInfo
(
DexNode
dex
,
int
mthIndex
)
{
MethodId
mthId
=
dex
.
getMethodId
(
mthIndex
);
name
=
dex
.
getString
(
mthId
.
getNameIndex
());
...
...
@@ -43,6 +39,10 @@ public final class MethodInfo {
shortId
=
signature
.
toString
();
}
public
static
MethodInfo
fromDex
(
DexNode
dex
,
int
mthIndex
)
{
return
new
MethodInfo
(
dex
,
mthIndex
);
}
public
String
getName
()
{
return
name
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/ArithOp.java
View file @
5557fd81
...
...
@@ -15,12 +15,12 @@ public enum ArithOp {
SHR
(
">>"
),
USHR
(
">>>"
);
private
final
String
symbol
;
private
ArithOp
(
String
symbol
)
{
this
.
symbol
=
symbol
;
}
private
final
String
symbol
;
public
String
getSymbol
()
{
return
this
.
symbol
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/ArgType.java
View file @
5557fd81
...
...
@@ -454,7 +454,7 @@ public abstract class ArgType {
types
.
add
(
type
);
}
}
if
(
types
.
size
()
==
0
)
{
if
(
types
.
isEmpty
()
)
{
return
null
;
}
else
if
(
types
.
size
()
==
1
)
{
PrimitiveType
nt
=
types
.
get
(
0
);
...
...
@@ -479,7 +479,7 @@ public abstract class ArgType {
String
aObj
=
a
.
getObject
();
String
bObj
=
b
.
getObject
();
if
(
aObj
.
equals
(
bObj
))
{
return
(
a
.
getGenericTypes
()
!=
null
?
a
:
b
)
;
return
a
.
getGenericTypes
()
!=
null
?
a
:
b
;
}
else
if
(
aObj
.
equals
(
Consts
.
CLASS_OBJECT
))
{
return
b
;
}
else
if
(
bObj
.
equals
(
Consts
.
CLASS_OBJECT
))
{
...
...
@@ -487,7 +487,7 @@ public abstract class ArgType {
}
else
{
// different objects
String
obj
=
clsp
.
getCommonAncestor
(
aObj
,
bObj
);
return
(
obj
==
null
?
null
:
object
(
obj
)
);
return
obj
==
null
?
null
:
object
(
obj
);
}
}
if
(
a
.
isArray
())
{
...
...
@@ -498,7 +498,7 @@ public abstract class ArgType {
return
OBJECT
;
}
else
{
ArgType
res
=
merge
(
ea
,
eb
);
return
(
res
==
null
?
null
:
ArgType
.
array
(
res
)
);
return
res
==
null
?
null
:
ArgType
.
array
(
res
);
}
}
else
if
(
b
.
equals
(
OBJECT
))
{
return
OBJECT
;
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/InsnWrapArg.java
View file @
5557fd81
...
...
@@ -7,8 +7,8 @@ public final class InsnWrapArg extends InsnArg {
private
final
InsnNode
wrappedInsn
;
public
InsnWrapArg
(
InsnNode
insn
)
{
ArgType
type
=
(
insn
.
getResult
()
==
null
?
ArgType
.
VOID
:
insn
.
getResult
().
getType
()
);
this
.
typedVar
=
new
TypedVar
(
type
);
RegisterArg
result
=
insn
.
getResult
(
);
this
.
typedVar
=
new
TypedVar
(
(
result
!=
null
?
result
.
getType
()
:
ArgType
.
VOID
)
);
this
.
wrappedInsn
=
insn
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/BlockNode.java
View file @
5557fd81
...
...
@@ -87,7 +87,7 @@ public class BlockNode extends AttrNode implements IBlock {
}
}
}
return
(
nodes
.
size
()
==
sucList
.
size
()
?
sucList
:
nodes
)
;
return
nodes
.
size
()
==
sucList
.
size
()
?
sucList
:
nodes
;
}
@Override
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
5557fd81
...
...
@@ -50,7 +50,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
private
Map
<
Object
,
FieldNode
>
constFields
=
Collections
.
emptyMap
();
private
List
<
ClassNode
>
innerClasses
=
Collections
.
emptyList
();
private
CodeWriter
code
;
// generated code
private
CodeWriter
code
;
public
ClassNode
(
DexNode
dex
,
ClassDef
cls
)
throws
DecodeException
{
this
.
dex
=
dex
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/AnnotationsParser.java
View file @
5557fd81
...
...
@@ -20,6 +20,12 @@ import com.android.dx.io.DexBuffer.Section;
public
class
AnnotationsParser
{
private
static
final
Annotation
.
Visibility
[]
VISIBILITIES
=
{
Visibility
.
BUILD
,
Visibility
.
RUNTIME
,
Visibility
.
SYSTEM
};
private
final
DexNode
dex
;
private
final
ClassNode
cls
;
...
...
@@ -76,12 +82,6 @@ public class AnnotationsParser {
return
new
AnnotationsList
(
list
);
}
private
static
final
Annotation
.
Visibility
[]
VISIBILITIES
=
{
Visibility
.
BUILD
,
Visibility
.
RUNTIME
,
Visibility
.
SYSTEM
};
public
static
Annotation
readAnnotation
(
DexNode
dex
,
Section
s
,
boolean
readVisibility
)
throws
DecodeException
{
EncValueParser
parser
=
new
EncValueParser
(
dex
,
s
);
Visibility
visibility
=
null
;
...
...
jadx-core/src/main/java/jadx/core/dex/regions/IfCondition.java
View file @
5557fd81
...
...
@@ -17,31 +17,6 @@ import java.util.List;
public
final
class
IfCondition
{
public
static
IfCondition
fromIfBlock
(
BlockNode
header
)
{
if
(
header
==
null
)
{
return
null
;
}
return
fromIfNode
((
IfNode
)
header
.
getInstructions
().
get
(
0
));
}
public
static
IfCondition
fromIfNode
(
IfNode
insn
)
{
return
new
IfCondition
(
new
Compare
(
insn
));
}
public
static
IfCondition
merge
(
Mode
mode
,
IfCondition
a
,
IfCondition
b
)
{
if
(
a
.
getMode
()
==
mode
)
{
IfCondition
n
=
new
IfCondition
(
a
);
n
.
addArg
(
b
);
return
n
;
}
else
if
(
b
.
getMode
()
==
mode
)
{
IfCondition
n
=
new
IfCondition
(
b
);
n
.
addArg
(
a
);
return
n
;
}
else
{
return
new
IfCondition
(
mode
,
Arrays
.
asList
(
a
,
b
));
}
}
public
static
enum
Mode
{
COMPARE
,
NOT
,
...
...
@@ -75,6 +50,31 @@ public final class IfCondition {
}
}
public
static
IfCondition
fromIfBlock
(
BlockNode
header
)
{
if
(
header
==
null
)
{
return
null
;
}
return
fromIfNode
((
IfNode
)
header
.
getInstructions
().
get
(
0
));
}
public
static
IfCondition
fromIfNode
(
IfNode
insn
)
{
return
new
IfCondition
(
new
Compare
(
insn
));
}
public
static
IfCondition
merge
(
Mode
mode
,
IfCondition
a
,
IfCondition
b
)
{
if
(
a
.
getMode
()
==
mode
)
{
IfCondition
n
=
new
IfCondition
(
a
);
n
.
addArg
(
b
);
return
n
;
}
else
if
(
b
.
getMode
()
==
mode
)
{
IfCondition
n
=
new
IfCondition
(
b
);
n
.
addArg
(
a
);
return
n
;
}
else
{
return
new
IfCondition
(
mode
,
Arrays
.
asList
(
a
,
b
));
}
}
public
Mode
getMode
()
{
return
mode
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/CodeShrinker.java
View file @
5557fd81
...
...
@@ -94,15 +94,15 @@ public class CodeShrinker extends AbstractVisitor {
private
boolean
canMove
(
int
from
,
int
to
)
{
List
<
RegisterArg
>
movedArgs
=
argsList
.
get
(
from
).
getArgs
();
from
++
;
if
(
from
==
to
)
{
int
start
=
from
+
1
;
if
(
start
==
to
)
{
// previous instruction or on edge of inline border
return
true
;
}
if
(
from
>
to
)
{
throw
new
JadxRuntimeException
(
"Invalid inline insn positions: "
+
from
+
" - "
+
to
);
if
(
start
>
to
)
{
throw
new
JadxRuntimeException
(
"Invalid inline insn positions: "
+
start
+
" - "
+
to
);
}
for
(
int
i
=
from
;
i
<
to
;
i
++)
{
for
(
int
i
=
start
;
i
<
to
;
i
++)
{
ArgsInfo
argsInfo
=
argsList
.
get
(
i
);
if
(
argsInfo
.
getInlinedInsn
()
==
this
)
{
continue
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/CheckRegions.java
View file @
5557fd81
...
...
@@ -21,7 +21,7 @@ public class CheckRegions extends AbstractVisitor {
@Override
public
void
visit
(
MethodNode
mth
)
throws
JadxException
{
if
(
mth
.
isNoCode
()
||
mth
.
getBasicBlocks
().
size
()
==
0
)
{
if
(
mth
.
isNoCode
()
||
mth
.
getBasicBlocks
().
isEmpty
()
)
{
return
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/CleanRegions.java
View file @
5557fd81
...
...
@@ -14,8 +14,11 @@ import org.slf4j.LoggerFactory;
public
class
CleanRegions
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
CleanRegions
.
class
);
private
CleanRegions
()
{
}
public
static
void
process
(
MethodNode
mth
)
{
if
(
mth
.
isNoCode
()
||
mth
.
getBasicBlocks
().
size
()
==
0
)
{
if
(
mth
.
isNoCode
()
||
mth
.
getBasicBlocks
().
isEmpty
()
)
{
return
;
}
IRegionVisitor
removeEmptyBlocks
=
new
AbstractRegionVisitor
()
{
...
...
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
View file @
5557fd81
...
...
@@ -15,6 +15,9 @@ import java.util.Set;
public
class
BlockUtils
{
private
BlockUtils
()
{
}
public
static
BlockNode
getBlockByOffset
(
int
offset
,
Iterable
<
BlockNode
>
casesBlocks
)
{
for
(
BlockNode
block
:
casesBlocks
)
{
if
(
block
.
getStartOffset
()
==
offset
)
{
...
...
jadx-core/src/main/java/jadx/core/utils/InsnList.java
View file @
5557fd81
...
...
@@ -8,6 +8,12 @@ import java.util.List;
public
final
class
InsnList
implements
Iterable
<
InsnNode
>
{
private
final
List
<
InsnNode
>
list
;
public
InsnList
(
List
<
InsnNode
>
list
)
{
this
.
list
=
list
;
}
public
static
void
remove
(
List
<
InsnNode
>
list
,
InsnNode
insn
)
{
for
(
Iterator
<
InsnNode
>
iterator
=
list
.
iterator
();
iterator
.
hasNext
();
)
{
InsnNode
next
=
iterator
.
next
();
...
...
@@ -33,12 +39,6 @@ public final class InsnList implements Iterable<InsnNode> {
return
-
1
;
}
private
final
List
<
InsnNode
>
list
;
public
InsnList
(
List
<
InsnNode
>
list
)
{
this
.
list
=
list
;
}
public
int
getIndex
(
InsnNode
insn
)
{
return
getIndex
(
list
,
insn
);
}
...
...
jadx-core/src/main/java/jadx/core/utils/InsnUtils.java
View file @
5557fd81
...
...
@@ -7,6 +7,9 @@ import com.android.dx.io.instructions.DecodedInstruction;
public
class
InsnUtils
{
private
InsnUtils
()
{
}
public
static
int
getArg
(
DecodedInstruction
insn
,
int
arg
)
{
switch
(
arg
)
{
case
0
:
...
...
jadx-core/src/main/java/jadx/core/utils/RegionUtils.java
View file @
5557fd81
...
...
@@ -14,6 +14,9 @@ import java.util.List;
public
class
RegionUtils
{
private
RegionUtils
()
{
}
public
static
boolean
hasExitEdge
(
IContainer
container
)
{
if
(
container
instanceof
BlockNode
)
{
BlockNode
block
=
(
BlockNode
)
container
;
...
...
jadx-core/src/main/java/jadx/core/utils/StringUtils.java
View file @
5557fd81
...
...
@@ -2,6 +2,9 @@ package jadx.core.utils;
public
class
StringUtils
{
private
StringUtils
()
{
}
public
static
String
unescapeString
(
String
str
)
{
int
len
=
str
.
length
();
StringBuilder
res
=
new
StringBuilder
();
...
...
jadx-core/src/main/java/jadx/core/utils/Utils.java
View file @
5557fd81
...
...
@@ -8,6 +8,7 @@ import java.io.StringWriter;
import
java.util.Iterator
;
public
class
Utils
{
private
Utils
()
{
}
...
...
jadx-core/src/test/java/jadx/tests/internal/TestLineNumbers.java
View file @
5557fd81
...
...
@@ -15,7 +15,7 @@ import static org.junit.Assert.assertThat;
public
class
TestLineNumbers
extends
InternalJadxTest
{
public
static
class
TestCls
extends
Exception
{
public
static
class
TestCls
{
int
field
;
public
void
func
()
{
...
...
jadx-core/src/test/java/jadx/tests/internal/conditions/TestConditions2.java
View file @
5557fd81
...
...
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertThat;
public
class
TestConditions2
extends
InternalJadxTest
{
public
static
class
TestCls
extends
Exception
{
public
static
class
TestCls
{
int
c
;
String
d
;
String
f
;
...
...
jadx-core/src/test/java/jadx/tests/internal/inline/TestInline.java
View file @
5557fd81
...
...
@@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat;
public
class
TestInline
extends
InternalJadxTest
{
public
static
class
TestCls
extends
Exception
{
public
static
class
TestCls
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"Test: "
+
new
TestCls
().
testRun
());
}
...
...
jadx-core/src/test/java/jadx/tests/internal/inline/TestInline2.java
View file @
5557fd81
...
...
@@ -10,7 +10,7 @@ import static org.junit.Assert.assertThat;
public
class
TestInline2
extends
InternalJadxTest
{
public
static
class
TestCls
extends
Exception
{
public
static
class
TestCls
{
public
int
simple_loops
()
throws
InterruptedException
{
int
[]
a
=
new
int
[]{
1
,
2
,
4
,
6
,
8
};
int
b
=
0
;
...
...
jadx-core/src/test/java/jadx/tests/internal/inline/TestInline6.java
View file @
5557fd81
...
...
@@ -24,7 +24,6 @@ public class TestInline6 extends InternalJadxTest {
@Test
public
void
test
()
{
setOutputCFG
();
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/TextNode.java
View file @
5557fd81
...
...
@@ -3,6 +3,9 @@ package jadx.gui.treemodel;
import
javax.swing.Icon
;
public
class
TextNode
extends
JNode
{
private
static
final
long
serialVersionUID
=
2342749142368352232L
;
private
final
String
label
;
public
TextNode
(
String
str
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment