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
d7ce41e7
Commit
d7ce41e7
authored
Aug 20, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: don't remove synthetic methods with some logic beside casts (#336)
parent
eaaeb2c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
ClassModifier.java
...e/src/main/java/jadx/core/dex/visitors/ClassModifier.java
+19
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/ClassModifier.java
View file @
d7ce41e7
...
@@ -216,6 +216,12 @@ public class ClassModifier extends AbstractVisitor {
...
@@ -216,6 +216,12 @@ public class ClassModifier extends AbstractVisitor {
MethodInfo
callMth
=
((
InvokeNode
)
insn
).
getCallMth
();
MethodInfo
callMth
=
((
InvokeNode
)
insn
).
getCallMth
();
MethodNode
wrappedMth
=
mth
.
root
().
deepResolveMethod
(
callMth
);
MethodNode
wrappedMth
=
mth
.
root
().
deepResolveMethod
(
callMth
);
if
(
wrappedMth
!=
null
)
{
if
(
wrappedMth
!=
null
)
{
// all args must be registers passed from method args (allow only casts insns)
for
(
InsnArg
arg
:
insn
.
getArguments
())
{
if
(!
registersAndCastsOnly
(
arg
))
{
return
false
;
}
}
String
alias
=
mth
.
getAlias
();
String
alias
=
mth
.
getAlias
();
if
(!
wrappedMth
.
getAlias
().
equals
(
alias
)
&&
wrappedMth
.
isVirtual
())
{
if
(!
wrappedMth
.
getAlias
().
equals
(
alias
)
&&
wrappedMth
.
isVirtual
())
{
wrappedMth
.
getMethodInfo
().
setAlias
(
alias
);
wrappedMth
.
getMethodInfo
().
setAlias
(
alias
);
...
@@ -226,6 +232,19 @@ public class ClassModifier extends AbstractVisitor {
...
@@ -226,6 +232,19 @@ public class ClassModifier extends AbstractVisitor {
return
false
;
return
false
;
}
}
private
static
boolean
registersAndCastsOnly
(
InsnArg
arg
)
{
if
(
arg
.
isRegister
())
{
return
true
;
}
if
(
arg
.
isInsnWrap
())
{
InsnNode
wrapInsn
=
((
InsnWrapArg
)
arg
).
getWrapInsn
();
if
(
wrapInsn
.
getType
()
==
InsnType
.
CHECK_CAST
)
{
return
registersAndCastsOnly
(
wrapInsn
.
getArg
(
0
));
}
}
return
false
;
}
private
static
boolean
isMethodUnique
(
ClassNode
cls
,
MethodNode
mth
)
{
private
static
boolean
isMethodUnique
(
ClassNode
cls
,
MethodNode
mth
)
{
MethodInfo
mi
=
mth
.
getMethodInfo
();
MethodInfo
mi
=
mth
.
getMethodInfo
();
for
(
MethodNode
otherMth
:
cls
.
getMethods
())
{
for
(
MethodNode
otherMth
:
cls
.
getMethods
())
{
...
...
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