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
f715d6ce
Commit
f715d6ce
authored
Apr 05, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix inherited methods renaming
parent
350b6054
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
15 deletions
+73
-15
InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+6
-3
MethodInfo.java
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
+15
-11
DexNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
+52
-1
No files found.
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
View file @
f715d6ce
...
...
@@ -575,9 +575,12 @@ public class InsnGen {
MethodInfo
callMth
=
insn
.
getCallMth
();
// inline method
MethodNode
callMthNode
=
mth
.
dex
().
resolveMethod
(
callMth
);
if
(
callMthNode
!=
null
&&
inlineMethod
(
callMthNode
,
insn
,
code
))
{
return
;
MethodNode
callMthNode
=
mth
.
dex
().
deepResolveMethod
(
callMth
);
if
(
callMthNode
!=
null
)
{
if
(
inlineMethod
(
callMthNode
,
insn
,
code
))
{
return
;
}
callMth
=
callMthNode
.
getMethodInfo
();
}
int
k
=
0
;
...
...
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
View file @
f715d6ce
...
...
@@ -28,17 +28,7 @@ public final class MethodInfo {
ProtoId
proto
=
dex
.
getProtoId
(
mthId
.
getProtoIndex
());
retType
=
dex
.
getType
(
proto
.
getReturnTypeIndex
());
args
=
dex
.
readParamList
(
proto
.
getParametersOffset
());
StringBuilder
signature
=
new
StringBuilder
();
signature
.
append
(
name
);
signature
.
append
(
'('
);
for
(
ArgType
arg
:
args
)
{
signature
.
append
(
TypeGen
.
signature
(
arg
));
}
signature
.
append
(
')'
);
signature
.
append
(
TypeGen
.
signature
(
retType
));
shortId
=
signature
.
toString
();
shortId
=
makeSignature
(
true
);
}
public
static
MethodInfo
fromDex
(
DexNode
dex
,
int
mthIndex
)
{
...
...
@@ -50,6 +40,20 @@ public final class MethodInfo {
return
dex
.
getInfoStorage
().
putMethod
(
mthIndex
,
mth
);
}
public
String
makeSignature
(
boolean
includeRetType
)
{
StringBuilder
signature
=
new
StringBuilder
();
signature
.
append
(
name
);
signature
.
append
(
'('
);
for
(
ArgType
arg
:
args
)
{
signature
.
append
(
TypeGen
.
signature
(
arg
));
}
signature
.
append
(
')'
);
if
(
includeRetType
)
{
signature
.
append
(
TypeGen
.
signature
(
retType
));
}
return
signature
.
toString
();
}
public
String
getName
()
{
return
name
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
View file @
f715d6ce
...
...
@@ -14,6 +14,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
com.android.dex.ClassData
;
...
...
@@ -87,7 +88,15 @@ public class DexNode {
}
@Nullable
public
MethodNode
resolveMethod
(
MethodInfo
mth
)
{
public
ClassNode
resolveClass
(
@NotNull
ArgType
type
)
{
if
(
type
.
isGeneric
())
{
type
=
ArgType
.
object
(
type
.
getObject
());
}
return
resolveClass
(
ClassInfo
.
fromType
(
this
,
type
));
}
@Nullable
public
MethodNode
resolveMethod
(
@NotNull
MethodInfo
mth
)
{
ClassNode
cls
=
resolveClass
(
mth
.
getDeclClass
());
if
(
cls
!=
null
)
{
return
cls
.
searchMethod
(
mth
);
...
...
@@ -95,6 +104,48 @@ public class DexNode {
return
null
;
}
/**
* Search method in class hierarchy.
*/
@Nullable
public
MethodNode
deepResolveMethod
(
@NotNull
MethodInfo
mth
)
{
ClassNode
cls
=
resolveClass
(
mth
.
getDeclClass
());
if
(
cls
==
null
)
{
return
null
;
}
return
deepResolveMethod
(
cls
,
mth
.
makeSignature
(
false
));
}
@Nullable
private
MethodNode
deepResolveMethod
(
@NotNull
ClassNode
cls
,
String
signature
)
{
for
(
MethodNode
m
:
cls
.
getMethods
())
{
if
(
m
.
getMethodInfo
().
getShortId
().
startsWith
(
signature
))
{
return
m
;
}
}
MethodNode
found
;
ArgType
superClass
=
cls
.
getSuperClass
();
if
(
superClass
!=
null
)
{
ClassNode
superNode
=
resolveClass
(
superClass
);
if
(
superNode
!=
null
)
{
found
=
deepResolveMethod
(
superNode
,
signature
);
if
(
found
!=
null
)
{
return
found
;
}
}
}
for
(
ArgType
iFaceType
:
cls
.
getInterfaces
())
{
ClassNode
iFaceNode
=
resolveClass
(
iFaceType
);
if
(
iFaceNode
!=
null
)
{
found
=
deepResolveMethod
(
iFaceNode
,
signature
);
if
(
found
!=
null
)
{
return
found
;
}
}
}
return
null
;
}
@Nullable
public
FieldNode
resolveField
(
FieldInfo
field
)
{
ClassNode
cls
=
resolveClass
(
field
.
getDeclClass
());
...
...
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