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
b46093b3
Commit
b46093b3
authored
Aug 09, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: add method info cache
parent
2b9c0927
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
MethodInfo.java
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
+1
-4
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+13
-6
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+4
-4
No files found.
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
View file @
b46093b3
...
@@ -132,10 +132,7 @@ public final class MethodInfo {
...
@@ -132,10 +132,7 @@ public final class MethodInfo {
if
(
this
==
obj
)
{
if
(
this
==
obj
)
{
return
true
;
return
true
;
}
}
if
(
obj
==
null
)
{
if
(!(
obj
instanceof
MethodInfo
))
{
return
false
;
}
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
return
false
;
}
}
MethodInfo
other
=
(
MethodInfo
)
obj
;
MethodInfo
other
=
(
MethodInfo
)
obj
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
b46093b3
...
@@ -25,6 +25,7 @@ import jadx.core.utils.exceptions.JadxRuntimeException;
...
@@ -25,6 +25,7 @@ import jadx.core.utils.exceptions.JadxRuntimeException;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -65,6 +66,9 @@ public class ClassNode extends LineAttrNode implements ILoadable {
...
@@ -65,6 +66,9 @@ public class ClassNode extends LineAttrNode implements ILoadable {
private
ProcessState
state
=
ProcessState
.
NOT_LOADED
;
private
ProcessState
state
=
ProcessState
.
NOT_LOADED
;
private
final
Set
<
ClassNode
>
dependencies
=
new
HashSet
<
ClassNode
>();
private
final
Set
<
ClassNode
>
dependencies
=
new
HashSet
<
ClassNode
>();
// cache maps
private
Map
<
MethodInfo
,
MethodNode
>
mthInfoMap
=
Collections
.
emptyMap
();
public
ClassNode
(
DexNode
dex
,
ClassDef
cls
)
throws
DecodeException
{
public
ClassNode
(
DexNode
dex
,
ClassDef
cls
)
throws
DecodeException
{
this
.
dex
=
dex
;
this
.
dex
=
dex
;
this
.
clsInfo
=
ClassInfo
.
fromDex
(
dex
,
cls
.
getTypeIndex
());
this
.
clsInfo
=
ClassInfo
.
fromDex
(
dex
,
cls
.
getTypeIndex
());
...
@@ -126,6 +130,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
...
@@ -126,6 +130,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
}
}
this
.
accessFlags
=
new
AccessInfo
(
accFlagsValue
,
AFType
.
CLASS
);
this
.
accessFlags
=
new
AccessInfo
(
accFlagsValue
,
AFType
.
CLASS
);
buildCache
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
DecodeException
(
"Error decode class: "
+
clsInfo
,
e
);
throw
new
DecodeException
(
"Error decode class: "
+
clsInfo
,
e
);
}
}
...
@@ -278,6 +283,13 @@ public class ClassNode extends LineAttrNode implements ILoadable {
...
@@ -278,6 +283,13 @@ public class ClassNode extends LineAttrNode implements ILoadable {
}
}
}
}
private
void
buildCache
()
{
mthInfoMap
=
new
HashMap
<
MethodInfo
,
MethodNode
>(
methods
.
size
());
for
(
MethodNode
mth
:
methods
)
{
mthInfoMap
.
put
(
mth
.
getMethodInfo
(),
mth
);
}
}
@Nullable
@Nullable
public
ArgType
getSuperClass
()
{
public
ArgType
getSuperClass
()
{
return
superClass
;
return
superClass
;
...
@@ -384,12 +396,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
...
@@ -384,12 +396,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
}
}
public
MethodNode
searchMethod
(
MethodInfo
mth
)
{
public
MethodNode
searchMethod
(
MethodInfo
mth
)
{
for
(
MethodNode
m
:
methods
)
{
return
mthInfoMap
.
get
(
mth
);
if
(
m
.
getMethodInfo
().
equals
(
mth
))
{
return
m
;
}
}
return
null
;
}
}
public
MethodNode
searchMethodByName
(
String
shortId
)
{
public
MethodNode
searchMethodByName
(
String
shortId
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
b46093b3
...
@@ -513,11 +513,11 @@ public class MethodNode extends LineAttrNode implements ILoadable {
...
@@ -513,11 +513,11 @@ public class MethodNode extends LineAttrNode implements ILoadable {
}
}
String
name
=
getName
();
String
name
=
getName
();
List
<
MethodNode
>
methods
=
parentClass
.
getMethods
();
for
(
MethodNode
method
:
parentClass
.
getMethods
())
{
for
(
MethodNode
method
:
methods
)
{
MethodInfo
otherMthInfo
=
method
.
mthInfo
;
if
(
this
!=
method
if
(
this
!=
method
&&
method
.
getName
().
equals
(
name
)
&&
otherMthInfo
.
getArgumentsTypes
().
size
()
==
argsCount
&&
method
.
mthInfo
.
getArgumentsTypes
().
size
()
==
argsCount
)
{
&&
otherMthInfo
.
getName
().
equals
(
name
)
)
{
return
true
;
return
true
;
}
}
}
}
...
...
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