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
96db1c24
Commit
96db1c24
authored
May 12, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: reformat code
parent
7abdb41a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
44 additions
and
59 deletions
+44
-59
DexNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
+2
-2
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+1
-15
AnnotationsParser.java
...in/java/jadx/core/dex/nodes/parser/AnnotationsParser.java
+6
-6
DebugInfoParser.java
...main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
+2
-2
EncValueParser.java
.../main/java/jadx/core/dex/nodes/parser/EncValueParser.java
+21
-25
StaticValuesParser.java
...n/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
+2
-2
PrepareForCodeGen.java
...c/main/java/jadx/core/dex/visitors/PrepareForCodeGen.java
+1
-1
InternalJadxTest.java
jadx-core/src/test/java/jadx/api/InternalJadxTest.java
+3
-3
TestSignatureParser.java
.../java/jadx/core/dex/nodes/parser/TestSignatureParser.java
+4
-2
TestConditions5.java
.../java/jadx/tests/internal/conditions/TestConditions5.java
+2
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
View file @
96db1c24
...
...
@@ -18,11 +18,11 @@ import com.android.dex.ClassData.Method;
import
com.android.dex.ClassDef
;
import
com.android.dex.Code
;
import
com.android.dex.Dex
;
import
com.android.dex.Dex.Section
;
import
com.android.dex.FieldId
;
import
com.android.dex.MethodId
;
import
com.android.dex.ProtoId
;
import
com.android.dex.TypeList
;
import
com.android.dex.TableOfContents
;
public
class
DexNode
{
...
...
@@ -116,7 +116,7 @@ public class DexNode {
return
dexBuf
.
readCode
(
mth
);
}
public
Dex
.
Section
openSection
(
int
offset
)
{
public
Section
openSection
(
int
offset
)
{
return
dexBuf
.
open
(
offset
);
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
96db1c24
...
...
@@ -238,24 +238,10 @@ public class MethodNode extends LineAttrNode implements ILoadable {
return
genericMap
;
}
// TODO: move to external class
private
void
initTryCatches
(
Code
mthCode
,
InsnNode
[]
insnByOffset
)
{
CatchHandler
[]
catchBlocks
=
mthCode
.
getCatchHandlers
();
Try
[]
tries
=
mthCode
.
getTries
();
// Bug in dx library already fixed (Try.getHandlerOffset() replaced by Try.getCatchHandlerIndex())
// and we don't need this mapping anymore,
// but in maven repository still old version
Set
<
Integer
>
handlerSet
=
new
HashSet
<
Integer
>(
tries
.
length
);
for
(
Try
aTry
:
tries
)
{
handlerSet
.
add
(
aTry
.
getCatchHandlerIndex
());
}
List
<
Integer
>
handlerList
=
new
ArrayList
<
Integer
>(
catchBlocks
.
length
);
handlerList
.
addAll
(
handlerSet
);
Collections
.
sort
(
handlerList
);
handlerSet
=
null
;
// -------------------
int
hc
=
0
;
Set
<
Integer
>
addrs
=
new
HashSet
<
Integer
>();
List
<
TryCatchBlock
>
catches
=
new
ArrayList
<
TryCatchBlock
>(
catchBlocks
.
length
);
...
...
@@ -306,7 +292,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
// attach TRY_ENTER, TRY_LEAVE attributes to instructions
for
(
Try
aTry
:
tries
)
{
int
catchNum
=
handlerList
.
indexOf
(
aTry
.
getCatchHandlerIndex
()
);
int
catchNum
=
aTry
.
getCatchHandlerIndex
(
);
TryCatchBlock
block
=
catches
.
get
(
catchNum
);
int
offset
=
aTry
.
getStartAddress
();
int
end
=
offset
+
aTry
.
getInstructionCount
()
-
1
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/AnnotationsParser.java
View file @
96db1c24
...
...
@@ -16,7 +16,7 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.android.dex.Dex
;
import
com.android.dex.Dex
.Section
;
public
class
AnnotationsParser
{
...
...
@@ -35,7 +35,7 @@ public class AnnotationsParser {
}
public
void
parse
(
int
offset
)
throws
DecodeException
{
Dex
.
Section
section
=
dex
.
openSection
(
offset
);
Section
section
=
dex
.
openSection
(
offset
);
// TODO read as unsigned int
int
classAnnotationsOffset
=
section
.
readInt
();
...
...
@@ -60,7 +60,7 @@ public class AnnotationsParser {
for
(
int
i
=
0
;
i
<
annotatedParametersCount
;
i
++)
{
MethodNode
mth
=
cls
.
searchMethodById
(
section
.
readInt
());
// read annotation ref list
Dex
.
Section
ss
=
dex
.
openSection
(
section
.
readInt
());
Section
ss
=
dex
.
openSection
(
section
.
readInt
());
int
size
=
ss
.
readInt
();
MethodParameters
params
=
new
MethodParameters
(
size
);
for
(
int
j
=
0
;
j
<
size
;
j
++)
{
...
...
@@ -71,18 +71,18 @@ public class AnnotationsParser {
}
private
AnnotationsList
readAnnotationSet
(
int
offset
)
throws
DecodeException
{
Dex
.
Section
section
=
dex
.
openSection
(
offset
);
Section
section
=
dex
.
openSection
(
offset
);
int
size
=
section
.
readInt
();
List
<
Annotation
>
list
=
new
ArrayList
<
Annotation
>(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Dex
.
Section
anSection
=
dex
.
openSection
(
section
.
readInt
());
Section
anSection
=
dex
.
openSection
(
section
.
readInt
());
Annotation
a
=
readAnnotation
(
dex
,
anSection
,
true
);
list
.
add
(
a
);
}
return
new
AnnotationsList
(
list
);
}
public
static
Annotation
readAnnotation
(
DexNode
dex
,
Dex
.
Section
s
,
boolean
readVisibility
)
throws
DecodeException
{
public
static
Annotation
readAnnotation
(
DexNode
dex
,
Section
s
,
boolean
readVisibility
)
throws
DecodeException
{
EncValueParser
parser
=
new
EncValueParser
(
dex
,
s
);
Visibility
visibility
=
null
;
if
(
readVisibility
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
View file @
96db1c24
...
...
@@ -10,7 +10,7 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.List
;
import
com.android.dex.Dex
;
import
com.android.dex.Dex
.Section
;
public
class
DebugInfoParser
{
...
...
@@ -33,7 +33,7 @@ public class DebugInfoParser {
private
static
final
int
DBG_LINE_RANGE
=
15
;
private
final
MethodNode
mth
;
private
final
Dex
.
Section
section
;
private
final
Section
section
;
private
final
DexNode
dex
;
private
final
LocalVar
[]
locals
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/EncValueParser.java
View file @
96db1c24
...
...
@@ -8,37 +8,33 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.android.dex.Dex
;
import
com.android.dex.EncodedValue
;
import
com.android.dex.EncodedValueReader
;
import
com.android.dex.Dex.Section
;
import
com.android.dex.Leb128
;
import
com.android.dex.util.ByteInput
;
public
class
EncValueParser
{
public
static
final
int
ENCODED_BYTE
=
0x00
;
public
static
final
int
ENCODED_SHORT
=
0x02
;
public
static
final
int
ENCODED_CHAR
=
0x03
;
public
static
final
int
ENCODED_INT
=
0x04
;
public
static
final
int
ENCODED_LONG
=
0x06
;
public
static
final
int
ENCODED_FLOAT
=
0x10
;
public
static
final
int
ENCODED_DOUBLE
=
0x11
;
public
static
final
int
ENCODED_STRING
=
0x17
;
public
static
final
int
ENCODED_TYPE
=
0x18
;
public
static
final
int
ENCODED_FIELD
=
0x19
;
public
static
final
int
ENCODED_ENUM
=
0x1b
;
public
static
final
int
ENCODED_METHOD
=
0x1a
;
public
static
final
int
ENCODED_ARRAY
=
0x1c
;
public
static
final
int
ENCODED_ANNOTATION
=
0x1d
;
public
static
final
int
ENCODED_NULL
=
0x1e
;
public
static
final
int
ENCODED_BOOLEAN
=
0x1f
;
protected
final
Dex
.
Section
in
;
public
static
final
int
ENCODED_SHORT
=
0x02
;
public
static
final
int
ENCODED_CHAR
=
0x03
;
public
static
final
int
ENCODED_INT
=
0x04
;
public
static
final
int
ENCODED_LONG
=
0x06
;
public
static
final
int
ENCODED_FLOAT
=
0x10
;
public
static
final
int
ENCODED_DOUBLE
=
0x11
;
public
static
final
int
ENCODED_STRING
=
0x17
;
public
static
final
int
ENCODED_TYPE
=
0x18
;
public
static
final
int
ENCODED_FIELD
=
0x19
;
public
static
final
int
ENCODED_ENUM
=
0x1b
;
public
static
final
int
ENCODED_METHOD
=
0x1a
;
public
static
final
int
ENCODED_ARRAY
=
0x1c
;
public
static
final
int
ENCODED_ANNOTATION
=
0x1d
;
public
static
final
int
ENCODED_NULL
=
0x1e
;
public
static
final
int
ENCODED_BOOLEAN
=
0x1f
;
protected
final
Section
in
;
private
final
DexNode
dex
;
public
EncValueParser
(
DexNode
dex
,
Dex
.
Section
in
)
{
//super(in);
public
EncValueParser
(
DexNode
dex
,
Section
in
)
{
this
.
in
=
in
;
this
.
dex
=
dex
;
}
...
...
@@ -94,7 +90,7 @@ public class EncValueParser {
return
values
;
case
ENCODED_ANNOTATION:
return
AnnotationsParser
.
readAnnotation
(
dex
,
(
Dex
.
Section
)
in
,
false
);
return
AnnotationsParser
.
readAnnotation
(
dex
,
in
,
false
);
}
throw
new
DecodeException
(
"Unknown encoded value type: 0x"
+
Integer
.
toHexString
(
type
));
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
View file @
96db1c24
...
...
@@ -6,12 +6,12 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.List
;
import
com.android.dex.Dex
;
import
com.android.dex.Dex
.Section
;
import
com.android.dex.Leb128
;
public
class
StaticValuesParser
extends
EncValueParser
{
public
StaticValuesParser
(
DexNode
dex
,
Dex
.
Section
in
)
{
public
StaticValuesParser
(
DexNode
dex
,
Section
in
)
{
super
(
dex
,
in
);
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/PrepareForCodeGen.java
View file @
96db1c24
...
...
@@ -66,7 +66,7 @@ public class PrepareForCodeGen extends AbstractVisitor {
if
(
insn
.
getType
()
==
InsnType
.
MOVE
&&
insn
.
getArg
(
0
).
isInsnWrap
()
&&
!
insn
.
getAttributes
().
contains
(
AttributeFlag
.
DECLARE_VAR
))
{
InsnNode
wrapInsn
=
((
InsnWrapArg
)
insn
.
getArg
(
0
)).
getWrapInsn
();
InsnNode
wrapInsn
=
((
InsnWrapArg
)
insn
.
getArg
(
0
)).
getWrapInsn
();
wrapInsn
.
setResult
(
insn
.
getResult
());
list
.
set
(
i
,
wrapInsn
);
}
...
...
jadx-core/src/test/java/jadx/api/InternalJadxTest.java
View file @
96db1c24
...
...
@@ -18,12 +18,12 @@ import java.util.List;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarOutputStream
;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
import
static
junit
.
framework
.
Assert
.
assertNotNull
;
import
static
junit
.
framework
.
Assert
.
fail
;
import
static
org
.
hamcrest
.
CoreMatchers
.
containsString
;
import
static
org
.
hamcrest
.
CoreMatchers
.
not
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
fail
;
public
abstract
class
InternalJadxTest
extends
TestUtils
{
...
...
jadx-core/src/test/java/jadx/core/dex/nodes/parser/TestSignatureParser.java
View file @
96db1c24
...
...
@@ -37,7 +37,8 @@ public class TestSignatureParser {
assertEquals
(
p
(
"La<Lb<Lc;>;>;"
).
consumeType
(),
ArgType
.
generic
(
"La;"
,
new
ArgType
[]{
ArgType
.
generic
(
"Lb;"
,
new
ArgType
[]{
ArgType
.
object
(
"Lc;"
)})}));
ArgType
.
object
(
"Lc;"
)})})
);
}
@Test
...
...
@@ -47,7 +48,8 @@ public class TestSignatureParser {
assertEquals
(
p
(
"La<Lb;>.c<TV;>;"
).
consumeType
(),
ArgType
.
genericInner
(
ArgType
.
generic
(
"La;"
,
new
ArgType
[]{
ArgType
.
object
(
"Lb;"
)}),
"c"
,
new
ArgType
[]{
ArgType
.
genericType
(
"V"
)}));
"c"
,
new
ArgType
[]{
ArgType
.
genericType
(
"V"
)})
);
assertEquals
(
p
(
"La<TV;>.LinkedHashIterator<Lb$c<Ls;TV;>;>;"
).
consumeType
().
getObject
(),
"a$LinkedHashIterator"
);
...
...
jadx-core/src/test/java/jadx/tests/internal/conditions/TestConditions5.java
View file @
96db1c24
...
...
@@ -14,8 +14,9 @@ public class TestConditions5 extends InternalJadxTest {
public
static
class
TestCls
{
public
static
void
assertEquals
(
Object
a1
,
Object
a2
)
{
if
(
a1
==
null
)
{
if
(
a2
!=
null
)
if
(
a2
!=
null
)
{
throw
new
AssertionError
(
a1
+
" != "
+
a2
);
}
}
else
if
(!
a1
.
equals
(
a2
))
{
throw
new
AssertionError
(
a1
+
" != "
+
a2
);
}
...
...
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