Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
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
81ee9e6b
Commit
81ee9e6b
authored
May 25, 2013
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code
parent
d5737ade
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
24 additions
and
53 deletions
+24
-53
ClassGen.java
src/main/java/jadx/codegen/ClassGen.java
+1
-1
RegionGen.java
src/main/java/jadx/codegen/RegionGen.java
+1
-1
TypeGen.java
src/main/java/jadx/codegen/TypeGen.java
+0
-15
ClassInfo.java
src/main/java/jadx/dex/info/ClassInfo.java
+2
-6
LocalVarInfo.java
src/main/java/jadx/dex/info/LocalVarInfo.java
+1
-1
IfNode.java
src/main/java/jadx/dex/instructions/IfNode.java
+1
-1
TernaryInsn.java
src/main/java/jadx/dex/instructions/mods/TernaryInsn.java
+1
-1
BlockNode.java
src/main/java/jadx/dex/nodes/BlockNode.java
+1
-1
DexNode.java
src/main/java/jadx/dex/nodes/DexNode.java
+1
-2
RootNode.java
src/main/java/jadx/dex/nodes/RootNode.java
+1
-9
DebugInfoParser.java
src/main/java/jadx/dex/nodes/parser/DebugInfoParser.java
+1
-1
BlockMakerVisitor.java
src/main/java/jadx/dex/visitors/BlockMakerVisitor.java
+5
-5
BlockProcessingHelper.java
src/main/java/jadx/dex/visitors/BlockProcessingHelper.java
+2
-2
ConstInlinerVisitor.java
src/main/java/jadx/dex/visitors/ConstInlinerVisitor.java
+1
-1
MethodInlinerVisitor.java
src/main/java/jadx/dex/visitors/MethodInlinerVisitor.java
+1
-1
BlockUtils.java
src/main/java/jadx/utils/BlockUtils.java
+3
-3
Utils.java
src/main/java/jadx/utils/Utils.java
+1
-1
JadxRuntimeException.java
...main/java/jadx/utils/exceptions/JadxRuntimeException.java
+0
-1
No files found.
src/main/java/jadx/codegen/ClassGen.java
View file @
81ee9e6b
...
@@ -177,7 +177,7 @@ public class ClassGen {
...
@@ -177,7 +177,7 @@ public class ClassGen {
clsCode
.
startLine
(
'}'
);
clsCode
.
startLine
(
'}'
);
}
}
private
CodeWriter
makeInnerClasses
(
ClassNode
cls
2
,
int
indent
)
throws
CodegenException
{
private
CodeWriter
makeInnerClasses
(
ClassNode
cls
,
int
indent
)
throws
CodegenException
{
CodeWriter
innerClsCode
=
new
CodeWriter
(
indent
+
1
);
CodeWriter
innerClsCode
=
new
CodeWriter
(
indent
+
1
);
for
(
ClassNode
inCls
:
cls
.
getInnerClasses
())
{
for
(
ClassNode
inCls
:
cls
.
getInnerClasses
())
{
if
(
inCls
.
isAnonymous
())
if
(
inCls
.
isAnonymous
())
...
...
src/main/java/jadx/codegen/RegionGen.java
View file @
81ee9e6b
...
@@ -72,7 +72,7 @@ public class RegionGen extends InsnGen {
...
@@ -72,7 +72,7 @@ public class RegionGen extends InsnGen {
}
}
}
}
private
void
declareVars
(
CodeWriter
code
,
IContainer
cont
)
throws
CodegenException
{
private
void
declareVars
(
CodeWriter
code
,
IContainer
cont
)
{
DeclareVariableAttr
declVars
=
DeclareVariableAttr
declVars
=
(
DeclareVariableAttr
)
cont
.
getAttributes
().
get
(
AttributeType
.
DECLARE_VARIABLE
);
(
DeclareVariableAttr
)
cont
.
getAttributes
().
get
(
AttributeType
.
DECLARE_VARIABLE
);
if
(
declVars
!=
null
)
{
if
(
declVars
!=
null
)
{
...
...
src/main/java/jadx/codegen/TypeGen.java
View file @
81ee9e6b
...
@@ -22,21 +22,6 @@ public class TypeGen {
...
@@ -22,21 +22,6 @@ public class TypeGen {
return
stype
.
getLongName
();
return
stype
.
getLongName
();
}
}
@Deprecated
public
static
String
shortString
(
ArgType
type
)
{
final
PrimitiveType
stype
=
type
.
getPrimitiveType
();
if
(
stype
==
null
)
return
type
.
toString
();
if
(
stype
==
PrimitiveType
.
OBJECT
)
{
return
"L"
;
}
if
(
stype
==
PrimitiveType
.
ARRAY
)
{
return
shortString
(
type
.
getArrayElement
())
+
"A"
;
}
return
stype
.
getLongName
();
}
public
static
String
signature
(
ArgType
type
)
{
public
static
String
signature
(
ArgType
type
)
{
final
PrimitiveType
stype
=
type
.
getPrimitiveType
();
final
PrimitiveType
stype
=
type
.
getPrimitiveType
();
if
(
stype
==
PrimitiveType
.
OBJECT
)
{
if
(
stype
==
PrimitiveType
.
OBJECT
)
{
...
...
src/main/java/jadx/dex/info/ClassInfo.java
View file @
81ee9e6b
...
@@ -72,15 +72,11 @@ public final class ClassInfo {
...
@@ -72,15 +72,11 @@ public final class ClassInfo {
int
sep
=
name
.
lastIndexOf
(
'$'
);
int
sep
=
name
.
lastIndexOf
(
'$'
);
if
(
sep
>
0
&&
sep
!=
name
.
length
()
-
1
)
{
if
(
sep
>
0
&&
sep
!=
name
.
length
()
-
1
)
{
String
parClsName
=
pkg
+
'.'
+
name
.
substring
(
0
,
sep
);
String
parClsName
=
pkg
+
'.'
+
name
.
substring
(
0
,
sep
);
if
(
notObfuscated
||
dex
.
root
().
isClassExists
(
parClsName
))
{
parentClass
=
fromName
(
dex
,
parClsName
);
parentClass
=
fromName
(
dex
,
parClsName
);
name
=
name
.
substring
(
sep
+
1
);
name
=
name
.
substring
(
sep
+
1
);
}
else
{
}
else
{
parentClass
=
null
;
parentClass
=
null
;
}
}
}
else
{
parentClass
=
null
;
}
if
(
Character
.
isDigit
(
name
.
charAt
(
0
)))
if
(
Character
.
isDigit
(
name
.
charAt
(
0
)))
name
=
"InnerClass_"
+
name
;
name
=
"InnerClass_"
+
name
;
...
...
src/main/java/jadx/dex/info/LocalVarInfo.java
View file @
81ee9e6b
...
@@ -22,7 +22,7 @@ public class LocalVarInfo extends RegisterArg {
...
@@ -22,7 +22,7 @@ public class LocalVarInfo extends RegisterArg {
init
(
name
,
type
,
sign
);
init
(
name
,
type
,
sign
);
}
}
public
LocalVarInfo
(
DexNode
dex
,
RegisterArg
arg
)
{
public
LocalVarInfo
(
RegisterArg
arg
)
{
super
(
arg
.
getRegNum
());
super
(
arg
.
getRegNum
());
init
(
arg
.
getTypedVar
().
getName
(),
arg
.
getType
(),
null
);
init
(
arg
.
getTypedVar
().
getName
(),
arg
.
getType
(),
null
);
}
}
...
...
src/main/java/jadx/dex/instructions/IfNode.java
View file @
81ee9e6b
...
@@ -13,7 +13,7 @@ public class IfNode extends GotoNode {
...
@@ -13,7 +13,7 @@ public class IfNode extends GotoNode {
protected
boolean
zeroCmp
;
protected
boolean
zeroCmp
;
protected
IfOp
op
;
protected
IfOp
op
;
public
IfNode
(
IfOp
op
,
int
targ
,
InsnArg
then
,
InsnArg
els
)
{
public
IfNode
(
int
targ
,
InsnArg
then
,
InsnArg
els
)
{
super
(
InsnType
.
IF
,
targ
);
super
(
InsnType
.
IF
,
targ
);
addArg
(
then
);
addArg
(
then
);
if
(
els
==
null
)
{
if
(
els
==
null
)
{
...
...
src/main/java/jadx/dex/instructions/mods/TernaryInsn.java
View file @
81ee9e6b
...
@@ -11,7 +11,7 @@ import jadx.utils.Utils;
...
@@ -11,7 +11,7 @@ import jadx.utils.Utils;
public
class
TernaryInsn
extends
IfNode
{
public
class
TernaryInsn
extends
IfNode
{
public
TernaryInsn
(
IfOp
op
,
InsnNode
then
,
InsnNode
els
)
{
public
TernaryInsn
(
IfOp
op
,
InsnNode
then
,
InsnNode
els
)
{
super
(
op
,
then
.
getOffset
(),
super
(
then
.
getOffset
(),
InsnArg
.
wrap
(
then
),
InsnArg
.
wrap
(
then
),
els
==
null
?
null
:
InsnArg
.
wrap
(
els
));
els
==
null
?
null
:
InsnArg
.
wrap
(
els
));
}
}
...
...
src/main/java/jadx/dex/nodes/BlockNode.java
View file @
81ee9e6b
...
@@ -27,7 +27,7 @@ public class BlockNode extends AttrNode implements IBlock {
...
@@ -27,7 +27,7 @@ public class BlockNode extends AttrNode implements IBlock {
private
BlockRegState
startState
;
private
BlockRegState
startState
;
private
BlockRegState
endState
;
private
BlockRegState
endState
;
public
BlockNode
(
MethodNode
mth
,
int
id
,
int
offset
)
{
public
BlockNode
(
int
id
,
int
offset
)
{
this
.
id
=
id
;
this
.
id
=
id
;
this
.
startOffset
=
offset
;
this
.
startOffset
=
offset
;
}
}
...
...
src/main/java/jadx/dex/nodes/DexNode.java
View file @
81ee9e6b
...
@@ -6,7 +6,6 @@ import jadx.dex.instructions.args.ArgType;
...
@@ -6,7 +6,6 @@ import jadx.dex.instructions.args.ArgType;
import
jadx.utils.exceptions.DecodeException
;
import
jadx.utils.exceptions.DecodeException
;
import
jadx.utils.files.InputFile
;
import
jadx.utils.files.InputFile
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,7 +37,7 @@ public class DexNode {
...
@@ -38,7 +37,7 @@ public class DexNode {
this
.
strings
=
stringList
.
toArray
(
new
String
[
stringList
.
size
()]);
this
.
strings
=
stringList
.
toArray
(
new
String
[
stringList
.
size
()]);
}
}
public
void
loadClasses
(
RootNode
root
)
throws
DecodeException
{
public
void
loadClasses
()
throws
DecodeException
{
for
(
ClassDef
cls
:
dexBuf
.
classDefs
())
{
for
(
ClassDef
cls
:
dexBuf
.
classDefs
())
{
classes
.
add
(
new
ClassNode
(
this
,
cls
));
classes
.
add
(
new
ClassNode
(
this
,
cls
));
}
}
...
...
src/main/java/jadx/dex/nodes/RootNode.java
View file @
81ee9e6b
...
@@ -40,7 +40,7 @@ public class RootNode {
...
@@ -40,7 +40,7 @@ public class RootNode {
}
}
for
(
DexNode
dexNode
:
dexNodes
)
for
(
DexNode
dexNode
:
dexNodes
)
dexNode
.
loadClasses
(
this
);
dexNode
.
loadClasses
();
for
(
DexNode
dexNode
:
dexNodes
)
{
for
(
DexNode
dexNode
:
dexNodes
)
{
for
(
ClassNode
cls
:
dexNode
.
getClasses
())
for
(
ClassNode
cls
:
dexNode
.
getClasses
())
...
@@ -76,14 +76,6 @@ public class RootNode {
...
@@ -76,14 +76,6 @@ public class RootNode {
return
names
.
get
(
fullName
);
return
names
.
get
(
fullName
);
}
}
/**
* Without full classpath listing this function is useless
*/
@Deprecated
public
boolean
isClassExists
(
String
fullName
)
{
return
true
;
}
public
ClassNode
resolveClass
(
ClassInfo
cls
)
{
public
ClassNode
resolveClass
(
ClassInfo
cls
)
{
String
fullName
=
cls
.
getFullName
();
String
fullName
=
cls
.
getFullName
();
ClassNode
rCls
=
searchClassByName
(
fullName
);
ClassNode
rCls
=
searchClassByName
(
fullName
);
...
...
src/main/java/jadx/dex/nodes/parser/DebugInfoParser.java
View file @
81ee9e6b
...
@@ -67,7 +67,7 @@ public class DebugInfoParser {
...
@@ -67,7 +67,7 @@ public class DebugInfoParser {
for
(
RegisterArg
arg
:
mthArgs
)
{
for
(
RegisterArg
arg
:
mthArgs
)
{
int
rn
=
arg
.
getRegNum
();
int
rn
=
arg
.
getRegNum
();
locals
[
rn
]
=
new
LocalVarInfo
(
dex
,
arg
);
locals
[
rn
]
=
new
LocalVarInfo
(
arg
);
activeRegisters
[
rn
]
=
arg
;
activeRegisters
[
rn
]
=
arg
;
}
}
...
...
src/main/java/jadx/dex/visitors/BlockMakerVisitor.java
View file @
81ee9e6b
...
@@ -143,8 +143,8 @@ public class BlockMakerVisitor extends AbstractVisitor {
...
@@ -143,8 +143,8 @@ public class BlockMakerVisitor extends AbstractVisitor {
List
<
IAttribute
>
jumps
=
insn
.
getAttributes
().
getAll
(
AttributeType
.
JUMP
);
List
<
IAttribute
>
jumps
=
insn
.
getAttributes
().
getAll
(
AttributeType
.
JUMP
);
for
(
IAttribute
attr
:
jumps
)
{
for
(
IAttribute
attr
:
jumps
)
{
JumpAttribute
jump
=
(
JumpAttribute
)
attr
;
JumpAttribute
jump
=
(
JumpAttribute
)
attr
;
BlockNode
srcBlock
=
getBlock
(
mth
,
jump
.
getSrc
(),
blocksMap
);
BlockNode
srcBlock
=
getBlock
(
jump
.
getSrc
(),
blocksMap
);
BlockNode
thisblock
=
getBlock
(
mth
,
jump
.
getDest
(),
blocksMap
);
BlockNode
thisblock
=
getBlock
(
jump
.
getDest
(),
blocksMap
);
connect
(
srcBlock
,
thisblock
);
connect
(
srcBlock
,
thisblock
);
}
}
...
@@ -156,7 +156,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
...
@@ -156,7 +156,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
if
(
spl
!=
null
)
{
if
(
spl
!=
null
)
{
BlockNode
connBlock
=
((
SplitterBlockAttr
)
spl
).
getBlock
();
BlockNode
connBlock
=
((
SplitterBlockAttr
)
spl
).
getBlock
();
for
(
ExceptionHandler
h
:
catches
.
getTryBlock
().
getHandlers
())
{
for
(
ExceptionHandler
h
:
catches
.
getTryBlock
().
getHandlers
())
{
BlockNode
destBlock
=
getBlock
(
mth
,
h
.
getHandleOffset
(),
blocksMap
);
BlockNode
destBlock
=
getBlock
(
h
.
getHandleOffset
(),
blocksMap
);
// skip self loop in handler
// skip self loop in handler
if
(
connBlock
!=
destBlock
)
if
(
connBlock
!=
destBlock
)
// && !connBlock.getPredecessors().contains(destBlock))
// && !connBlock.getPredecessors().contains(destBlock))
...
@@ -183,7 +183,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
...
@@ -183,7 +183,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
}
}
}
}
private
static
BlockNode
getBlock
(
MethodNode
mth
,
int
offset
,
Map
<
Integer
,
BlockNode
>
blocksMap
)
{
private
static
BlockNode
getBlock
(
int
offset
,
Map
<
Integer
,
BlockNode
>
blocksMap
)
{
BlockNode
block
=
blocksMap
.
get
(
offset
);
BlockNode
block
=
blocksMap
.
get
(
offset
);
assert
block
!=
null
;
assert
block
!=
null
;
return
block
;
return
block
;
...
@@ -202,7 +202,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
...
@@ -202,7 +202,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
}
}
private
static
BlockNode
startNewBlock
(
MethodNode
mth
,
int
offset
)
{
private
static
BlockNode
startNewBlock
(
MethodNode
mth
,
int
offset
)
{
BlockNode
block
=
new
BlockNode
(
mth
,
++
nextBlockId
,
offset
);
BlockNode
block
=
new
BlockNode
(++
nextBlockId
,
offset
);
mth
.
getBasicBlocks
().
add
(
block
);
mth
.
getBasicBlocks
().
add
(
block
);
return
block
;
return
block
;
}
}
...
...
src/main/java/jadx/dex/visitors/BlockProcessingHelper.java
View file @
81ee9e6b
...
@@ -19,7 +19,7 @@ public class BlockProcessingHelper {
...
@@ -19,7 +19,7 @@ public class BlockProcessingHelper {
return
;
return
;
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
markExceptionHandlers
(
mth
,
block
);
markExceptionHandlers
(
block
);
}
}
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
block
.
updateCleanSuccessors
();
block
.
updateCleanSuccessors
();
...
@@ -35,7 +35,7 @@ public class BlockProcessingHelper {
...
@@ -35,7 +35,7 @@ public class BlockProcessingHelper {
/**
/**
* Set exception handler attribute for whole block
* Set exception handler attribute for whole block
*/
*/
private
static
void
markExceptionHandlers
(
MethodNode
mth
,
BlockNode
block
)
{
private
static
void
markExceptionHandlers
(
BlockNode
block
)
{
if
(!
block
.
getInstructions
().
isEmpty
())
{
if
(!
block
.
getInstructions
().
isEmpty
())
{
InsnNode
me
=
block
.
getInstructions
().
get
(
0
);
InsnNode
me
=
block
.
getInstructions
().
get
(
0
);
ExcHandlerAttr
handlerAttr
=
(
ExcHandlerAttr
)
me
.
getAttributes
().
get
(
AttributeType
.
EXC_HANDLER
);
ExcHandlerAttr
handlerAttr
=
(
ExcHandlerAttr
)
me
.
getAttributes
().
get
(
AttributeType
.
EXC_HANDLER
);
...
...
src/main/java/jadx/dex/visitors/ConstInlinerVisitor.java
View file @
81ee9e6b
...
@@ -105,7 +105,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
...
@@ -105,7 +105,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
/**
/**
* This is method similar to PostTypeResolver.visit method,
* This is method similar to PostTypeResolver.visit method,
* but contains some expensive operations needed only after const
s inlining
* but contains some expensive operations needed only after const
ant inline
*/
*/
private
static
void
fixTypes
(
MethodNode
mth
,
InsnNode
insn
)
{
private
static
void
fixTypes
(
MethodNode
mth
,
InsnNode
insn
)
{
switch
(
insn
.
getType
())
{
switch
(
insn
.
getType
())
{
...
...
src/main/java/jadx/dex/visitors/MethodInlinerVisitor.java
View file @
81ee9e6b
src/main/java/jadx/utils/BlockUtils.java
View file @
81ee9e6b
...
@@ -66,7 +66,7 @@ public class BlockUtils {
...
@@ -66,7 +66,7 @@ public class BlockUtils {
}
}
}
}
public
static
BlockNode
canMergeNextBlock
(
MethodNode
mth
,
BlockNode
block
)
{
public
static
BlockNode
canMergeNextBlock
(
BlockNode
block
)
{
BlockNode
next
=
getNextBlock
(
block
);
BlockNode
next
=
getNextBlock
(
block
);
if
(
next
!=
null
)
{
if
(
next
!=
null
)
{
if
(
next
.
getIDom
()
==
block
)
{
if
(
next
.
getIDom
()
==
block
)
{
...
...
src/main/java/jadx/utils/Utils.java
View file @
81ee9e6b
src/main/java/jadx/utils/exceptions/JadxRuntimeException.java
View file @
81ee9e6b
package
jadx
.
utils
.
exceptions
;
package
jadx
.
utils
.
exceptions
;
public
class
JadxRuntimeException
extends
RuntimeException
{
public
class
JadxRuntimeException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
7410848445429898248L
;
private
static
final
long
serialVersionUID
=
-
7410848445429898248L
;
...
...
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