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
Hide 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 {
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
);
for
(
ClassNode
inCls
:
cls
.
getInnerClasses
())
{
if
(
inCls
.
isAnonymous
())
...
...
src/main/java/jadx/codegen/RegionGen.java
View file @
81ee9e6b
...
...
@@ -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
)
cont
.
getAttributes
().
get
(
AttributeType
.
DECLARE_VARIABLE
);
if
(
declVars
!=
null
)
{
...
...
src/main/java/jadx/codegen/TypeGen.java
View file @
81ee9e6b
...
...
@@ -22,21 +22,6 @@ public class TypeGen {
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
)
{
final
PrimitiveType
stype
=
type
.
getPrimitiveType
();
if
(
stype
==
PrimitiveType
.
OBJECT
)
{
...
...
src/main/java/jadx/dex/info/ClassInfo.java
View file @
81ee9e6b
...
...
@@ -72,12 +72,8 @@ public final class ClassInfo {
int
sep
=
name
.
lastIndexOf
(
'$'
);
if
(
sep
>
0
&&
sep
!=
name
.
length
()
-
1
)
{
String
parClsName
=
pkg
+
'.'
+
name
.
substring
(
0
,
sep
);
if
(
notObfuscated
||
dex
.
root
().
isClassExists
(
parClsName
))
{
parentClass
=
fromName
(
dex
,
parClsName
);
name
=
name
.
substring
(
sep
+
1
);
}
else
{
parentClass
=
null
;
}
parentClass
=
fromName
(
dex
,
parClsName
);
name
=
name
.
substring
(
sep
+
1
);
}
else
{
parentClass
=
null
;
}
...
...
src/main/java/jadx/dex/info/LocalVarInfo.java
View file @
81ee9e6b
...
...
@@ -22,7 +22,7 @@ public class LocalVarInfo extends RegisterArg {
init
(
name
,
type
,
sign
);
}
public
LocalVarInfo
(
DexNode
dex
,
RegisterArg
arg
)
{
public
LocalVarInfo
(
RegisterArg
arg
)
{
super
(
arg
.
getRegNum
());
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 {
protected
boolean
zeroCmp
;
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
);
addArg
(
then
);
if
(
els
==
null
)
{
...
...
src/main/java/jadx/dex/instructions/mods/TernaryInsn.java
View file @
81ee9e6b
...
...
@@ -11,7 +11,7 @@ import jadx.utils.Utils;
public
class
TernaryInsn
extends
IfNode
{
public
TernaryInsn
(
IfOp
op
,
InsnNode
then
,
InsnNode
els
)
{
super
(
op
,
then
.
getOffset
(),
super
(
then
.
getOffset
(),
InsnArg
.
wrap
(
then
),
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 {
private
BlockRegState
startState
;
private
BlockRegState
endState
;
public
BlockNode
(
MethodNode
mth
,
int
id
,
int
offset
)
{
public
BlockNode
(
int
id
,
int
offset
)
{
this
.
id
=
id
;
this
.
startOffset
=
offset
;
}
...
...
src/main/java/jadx/dex/nodes/DexNode.java
View file @
81ee9e6b
...
...
@@ -6,7 +6,6 @@ import jadx.dex.instructions.args.ArgType;
import
jadx.utils.exceptions.DecodeException
;
import
jadx.utils.files.InputFile
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -38,7 +37,7 @@ public class DexNode {
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
())
{
classes
.
add
(
new
ClassNode
(
this
,
cls
));
}
...
...
src/main/java/jadx/dex/nodes/RootNode.java
View file @
81ee9e6b
...
...
@@ -40,7 +40,7 @@ public class RootNode {
}
for
(
DexNode
dexNode
:
dexNodes
)
dexNode
.
loadClasses
(
this
);
dexNode
.
loadClasses
();
for
(
DexNode
dexNode
:
dexNodes
)
{
for
(
ClassNode
cls
:
dexNode
.
getClasses
())
...
...
@@ -76,14 +76,6 @@ public class RootNode {
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
)
{
String
fullName
=
cls
.
getFullName
();
ClassNode
rCls
=
searchClassByName
(
fullName
);
...
...
src/main/java/jadx/dex/nodes/parser/DebugInfoParser.java
View file @
81ee9e6b
...
...
@@ -67,7 +67,7 @@ public class DebugInfoParser {
for
(
RegisterArg
arg
:
mthArgs
)
{
int
rn
=
arg
.
getRegNum
();
locals
[
rn
]
=
new
LocalVarInfo
(
dex
,
arg
);
locals
[
rn
]
=
new
LocalVarInfo
(
arg
);
activeRegisters
[
rn
]
=
arg
;
}
...
...
src/main/java/jadx/dex/visitors/BlockMakerVisitor.java
View file @
81ee9e6b
...
...
@@ -143,8 +143,8 @@ public class BlockMakerVisitor extends AbstractVisitor {
List
<
IAttribute
>
jumps
=
insn
.
getAttributes
().
getAll
(
AttributeType
.
JUMP
);
for
(
IAttribute
attr
:
jumps
)
{
JumpAttribute
jump
=
(
JumpAttribute
)
attr
;
BlockNode
srcBlock
=
getBlock
(
mth
,
jump
.
getSrc
(),
blocksMap
);
BlockNode
thisblock
=
getBlock
(
mth
,
jump
.
getDest
(),
blocksMap
);
BlockNode
srcBlock
=
getBlock
(
jump
.
getSrc
(),
blocksMap
);
BlockNode
thisblock
=
getBlock
(
jump
.
getDest
(),
blocksMap
);
connect
(
srcBlock
,
thisblock
);
}
...
...
@@ -156,7 +156,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
if
(
spl
!=
null
)
{
BlockNode
connBlock
=
((
SplitterBlockAttr
)
spl
).
getBlock
();
for
(
ExceptionHandler
h
:
catches
.
getTryBlock
().
getHandlers
())
{
BlockNode
destBlock
=
getBlock
(
mth
,
h
.
getHandleOffset
(),
blocksMap
);
BlockNode
destBlock
=
getBlock
(
h
.
getHandleOffset
(),
blocksMap
);
// skip self loop in handler
if
(
connBlock
!=
destBlock
)
// && !connBlock.getPredecessors().contains(destBlock))
...
...
@@ -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
);
assert
block
!=
null
;
return
block
;
...
...
@@ -202,7 +202,7 @@ public class BlockMakerVisitor extends AbstractVisitor {
}
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
);
return
block
;
}
...
...
src/main/java/jadx/dex/visitors/BlockProcessingHelper.java
View file @
81ee9e6b
...
...
@@ -19,7 +19,7 @@ public class BlockProcessingHelper {
return
;
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
markExceptionHandlers
(
mth
,
block
);
markExceptionHandlers
(
block
);
}
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
block
.
updateCleanSuccessors
();
...
...
@@ -35,7 +35,7 @@ public class BlockProcessingHelper {
/**
* 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
())
{
InsnNode
me
=
block
.
getInstructions
().
get
(
0
);
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 {
/**
* 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
)
{
switch
(
insn
.
getType
())
{
...
...
src/main/java/jadx/dex/visitors/MethodInlinerVisitor.java
View file @
81ee9e6b
...
...
@@ -40,7 +40,7 @@ public class MethodInlinerVisitor extends AbstractVisitor {
if
(
block
.
getInstructions
().
size
()
==
1
)
{
InsnNode
insn
=
block
.
getInstructions
().
get
(
0
);
addInlineAttr
(
mth
,
insn
);
}
}
}
}
}
...
...
src/main/java/jadx/utils/BlockUtils.java
View file @
81ee9e6b
...
...
@@ -52,8 +52,8 @@ public class BlockUtils {
if
(
from
.
getCleanSuccessors
().
contains
(
to
))
return
false
;
// already checked
return
from
.
getSuccessors
().
contains
(
to
);
}
return
from
.
getSuccessors
().
contains
(
to
);
}
/**
* Remove exception handlers from block nodes bitset
...
...
@@ -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
);
if
(
next
!=
null
)
{
if
(
next
.
getIDom
()
==
block
)
{
...
...
src/main/java/jadx/utils/Utils.java
View file @
81ee9e6b
...
...
@@ -126,7 +126,7 @@ public class Utils {
public
static
String
getJadxVersion
()
{
try
{
Enumeration
<
URL
>
resources
=
Utils
.
class
.
getClassLoader
().
getResources
(
"META-INF/MANIFEST.MF"
);
Utils
.
class
.
getClassLoader
().
getResources
(
"META-INF/MANIFEST.MF"
);
while
(
resources
.
hasMoreElements
())
{
Manifest
manifest
=
new
Manifest
(
resources
.
nextElement
().
openStream
());
String
ver
=
manifest
.
getMainAttributes
().
getValue
(
"jadx-version"
);
...
...
src/main/java/jadx/utils/exceptions/JadxRuntimeException.java
View file @
81ee9e6b
package
jadx
.
utils
.
exceptions
;
public
class
JadxRuntimeException
extends
RuntimeException
{
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