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
164123f5
Commit
164123f5
authored
Mar 01, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: improve variable names after 'toString' invoke
parent
72c301dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
NameGen.java
jadx-core/src/main/java/jadx/core/codegen/NameGen.java
+20
-8
No files found.
jadx-core/src/main/java/jadx/core/codegen/NameGen.java
View file @
164123f5
...
...
@@ -4,6 +4,7 @@ import jadx.core.Consts;
import
jadx.core.deobf.NameMapper
;
import
jadx.core.dex.attributes.nodes.LoopLabelAttr
;
import
jadx.core.dex.info.ClassInfo
;
import
jadx.core.dex.info.MethodInfo
;
import
jadx.core.dex.instructions.InvokeNode
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.InsnArg
;
...
...
@@ -187,14 +188,7 @@ public class NameGen {
switch
(
insn
.
getType
())
{
case
INVOKE:
InvokeNode
inv
=
(
InvokeNode
)
insn
;
String
name
=
inv
.
getCallMth
().
getName
();
if
(
name
.
startsWith
(
"get"
)
||
name
.
startsWith
(
"set"
))
{
return
fromName
(
name
.
substring
(
3
));
}
if
(
"iterator"
.
equals
(
name
))
{
return
"it"
;
}
return
name
;
return
makeNameFromInvoke
(
inv
.
getCallMth
());
case
CONSTRUCTOR:
ConstructorInsn
co
=
(
ConstructorInsn
)
insn
;
...
...
@@ -222,4 +216,22 @@ public class NameGen {
}
return
null
;
}
private
static
String
makeNameFromInvoke
(
MethodInfo
callMth
)
{
String
name
=
callMth
.
getName
();
if
(
name
.
startsWith
(
"get"
)
||
name
.
startsWith
(
"set"
))
{
return
fromName
(
name
.
substring
(
3
));
}
ArgType
declType
=
callMth
.
getDeclClass
().
getType
();
if
(
"iterator"
.
equals
(
name
))
{
return
"it"
;
}
if
(
"toString"
.
equals
(
name
))
{
return
makeNameForType
(
declType
);
}
if
(
"forName"
.
equals
(
name
)
&&
declType
.
equals
(
ArgType
.
CLASS
))
{
return
OBJ_ALIAS
.
get
(
Consts
.
CLASS_CLASS
);
}
return
name
;
}
}
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